<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Perl-compatible regular expressions: GLib Reference Manual</title>
<meta name="generator" content="DocBook XSL Stylesheets V1.79.1">
<link rel="home" href="index.html" title="GLib Reference Manual">
<link rel="up" href="glib-utilities.html" title="GLib Utilities">
<link rel="prev" href="glib-Glob-style-pattern-matching.html" title="Glob-style pattern matching">
<link rel="next" href="glib-regex-syntax.html" title="Regular expression syntax">
<meta name="generator" content="GTK-Doc V1.25.1 (XML mode)">
<link rel="stylesheet" href="style.css" type="text/css">
</head>
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
<table class="navigation" id="top" width="100%" summary="Navigation header" cellpadding="2" cellspacing="5"><tr valign="middle">
<td width="100%" align="left" class="shortcuts">
<a href="#" class="shortcut">Top</a><span id="nav_description">  <span class="dim">|</span> 
                  <a href="#glib-Perl-compatible-regular-expressions.description" class="shortcut">Description</a></span>
</td>
<td><a accesskey="h" href="index.html"><img src="home.png" width="16" height="16" border="0" alt="Home"></a></td>
<td><a accesskey="u" href="glib-utilities.html"><img src="up.png" width="16" height="16" border="0" alt="Up"></a></td>
<td><a accesskey="p" href="glib-Glob-style-pattern-matching.html"><img src="left.png" width="16" height="16" border="0" alt="Prev"></a></td>
<td><a accesskey="n" href="glib-regex-syntax.html"><img src="right.png" width="16" height="16" border="0" alt="Next"></a></td>
</tr></table>
<div class="refentry">
<a name="glib-Perl-compatible-regular-expressions"></a><div class="titlepage"></div>
<div class="refnamediv"><table width="100%"><tr>
<td valign="top">
<h2><span class="refentrytitle"><a name="glib-Perl-compatible-regular-expressions.top_of_page"></a>Perl-compatible regular expressions</span></h2>
<p>Perl-compatible regular expressions — matches strings against regular expressions</p>
</td>
<td class="gallery_image" valign="top" align="right"></td>
</tr></table></div>
<div class="refsect1">
<a name="glib-Perl-compatible-regular-expressions.functions"></a><h2>Functions</h2>
<div class="informaltable"><table class="informaltable" width="100%" border="0">
<colgroup>
<col width="150px" class="functions_return">
<col class="functions_name">
</colgroup>
<tbody>
<tr>
<td class="function_type">
<a class="link" href="glib-Basic-Types.html#gboolean" title="gboolean"><span class="returnvalue">gboolean</span></a>
</td>
<td class="function_name">
<span class="c_punctuation">(</span><a class="link" href="glib-Perl-compatible-regular-expressions.html#GRegexEvalCallback" title="GRegexEvalCallback ()">*GRegexEvalCallback</a><span class="c_punctuation">)</span> <span class="c_punctuation">()</span>
</td>
</tr>
<tr>
<td class="function_type">
<a class="link" href="glib-Perl-compatible-regular-expressions.html#GRegex" title="GRegex"><span class="returnvalue">GRegex</span></a> *
</td>
<td class="function_name">
<a class="link" href="glib-Perl-compatible-regular-expressions.html#g-regex-new" title="g_regex_new ()">g_regex_new</a> <span class="c_punctuation">()</span>
</td>
</tr>
<tr>
<td class="function_type">
<a class="link" href="glib-Perl-compatible-regular-expressions.html#GRegex" title="GRegex"><span class="returnvalue">GRegex</span></a> *
</td>
<td class="function_name">
<a class="link" href="glib-Perl-compatible-regular-expressions.html#g-regex-ref" title="g_regex_ref ()">g_regex_ref</a> <span class="c_punctuation">()</span>
</td>
</tr>
<tr>
<td class="function_type">
<span class="returnvalue">void</span>
</td>
<td class="function_name">
<a class="link" href="glib-Perl-compatible-regular-expressions.html#g-regex-unref" title="g_regex_unref ()">g_regex_unref</a> <span class="c_punctuation">()</span>
</td>
</tr>
<tr>
<td class="function_type">const <a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="returnvalue">gchar</span></a> *
</td>
<td class="function_name">
<a class="link" href="glib-Perl-compatible-regular-expressions.html#g-regex-get-pattern" title="g_regex_get_pattern ()">g_regex_get_pattern</a> <span class="c_punctuation">()</span>
</td>
</tr>
<tr>
<td class="function_type">
<a class="link" href="glib-Basic-Types.html#gint" title="gint ()"><span class="returnvalue">gint</span></a>
</td>
<td class="function_name">
<a class="link" href="glib-Perl-compatible-regular-expressions.html#g-regex-get-max-backref" title="g_regex_get_max_backref ()">g_regex_get_max_backref</a> <span class="c_punctuation">()</span>
</td>
</tr>
<tr>
<td class="function_type">
<a class="link" href="glib-Basic-Types.html#gint" title="gint ()"><span class="returnvalue">gint</span></a>
</td>
<td class="function_name">
<a class="link" href="glib-Perl-compatible-regular-expressions.html#g-regex-get-capture-count" title="g_regex_get_capture_count ()">g_regex_get_capture_count</a> <span class="c_punctuation">()</span>
</td>
</tr>
<tr>
<td class="function_type">
<a class="link" href="glib-Basic-Types.html#gboolean" title="gboolean"><span class="returnvalue">gboolean</span></a>
</td>
<td class="function_name">
<a class="link" href="glib-Perl-compatible-regular-expressions.html#g-regex-get-has-cr-or-lf" title="g_regex_get_has_cr_or_lf ()">g_regex_get_has_cr_or_lf</a> <span class="c_punctuation">()</span>
</td>
</tr>
<tr>
<td class="function_type">
<a class="link" href="glib-Basic-Types.html#gint" title="gint ()"><span class="returnvalue">gint</span></a>
</td>
<td class="function_name">
<a class="link" href="glib-Perl-compatible-regular-expressions.html#g-regex-get-max-lookbehind" title="g_regex_get_max_lookbehind ()">g_regex_get_max_lookbehind</a> <span class="c_punctuation">()</span>
</td>
</tr>
<tr>
<td class="function_type">
<a class="link" href="glib-Basic-Types.html#gint" title="gint ()"><span class="returnvalue">gint</span></a>
</td>
<td class="function_name">
<a class="link" href="glib-Perl-compatible-regular-expressions.html#g-regex-get-string-number" title="g_regex_get_string_number ()">g_regex_get_string_number</a> <span class="c_punctuation">()</span>
</td>
</tr>
<tr>
<td class="function_type">
<a class="link" href="glib-Perl-compatible-regular-expressions.html#GRegexCompileFlags" title="enum GRegexCompileFlags"><span class="returnvalue">GRegexCompileFlags</span></a>
</td>
<td class="function_name">
<a class="link" href="glib-Perl-compatible-regular-expressions.html#g-regex-get-compile-flags" title="g_regex_get_compile_flags ()">g_regex_get_compile_flags</a> <span class="c_punctuation">()</span>
</td>
</tr>
<tr>
<td class="function_type">
<a class="link" href="glib-Perl-compatible-regular-expressions.html#GRegexMatchFlags" title="enum GRegexMatchFlags"><span class="returnvalue">GRegexMatchFlags</span></a>
</td>
<td class="function_name">
<a class="link" href="glib-Perl-compatible-regular-expressions.html#g-regex-get-match-flags" title="g_regex_get_match_flags ()">g_regex_get_match_flags</a> <span class="c_punctuation">()</span>
</td>
</tr>
<tr>
<td class="function_type">
<a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="returnvalue">gchar</span></a> *
</td>
<td class="function_name">
<a class="link" href="glib-Perl-compatible-regular-expressions.html#g-regex-escape-string" title="g_regex_escape_string ()">g_regex_escape_string</a> <span class="c_punctuation">()</span>
</td>
</tr>
<tr>
<td class="function_type">
<a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="returnvalue">gchar</span></a> *
</td>
<td class="function_name">
<a class="link" href="glib-Perl-compatible-regular-expressions.html#g-regex-escape-nul" title="g_regex_escape_nul ()">g_regex_escape_nul</a> <span class="c_punctuation">()</span>
</td>
</tr>
<tr>
<td class="function_type">
<a class="link" href="glib-Basic-Types.html#gboolean" title="gboolean"><span class="returnvalue">gboolean</span></a>
</td>
<td class="function_name">
<a class="link" href="glib-Perl-compatible-regular-expressions.html#g-regex-match-simple" title="g_regex_match_simple ()">g_regex_match_simple</a> <span class="c_punctuation">()</span>
</td>
</tr>
<tr>
<td class="function_type">
<a class="link" href="glib-Basic-Types.html#gboolean" title="gboolean"><span class="returnvalue">gboolean</span></a>
</td>
<td class="function_name">
<a class="link" href="glib-Perl-compatible-regular-expressions.html#g-regex-match" title="g_regex_match ()">g_regex_match</a> <span class="c_punctuation">()</span>
</td>
</tr>
<tr>
<td class="function_type">
<a class="link" href="glib-Basic-Types.html#gboolean" title="gboolean"><span class="returnvalue">gboolean</span></a>
</td>
<td class="function_name">
<a class="link" href="glib-Perl-compatible-regular-expressions.html#g-regex-match-full" title="g_regex_match_full ()">g_regex_match_full</a> <span class="c_punctuation">()</span>
</td>
</tr>
<tr>
<td class="function_type">
<a class="link" href="glib-Basic-Types.html#gboolean" title="gboolean"><span class="returnvalue">gboolean</span></a>
</td>
<td class="function_name">
<a class="link" href="glib-Perl-compatible-regular-expressions.html#g-regex-match-all" title="g_regex_match_all ()">g_regex_match_all</a> <span class="c_punctuation">()</span>
</td>
</tr>
<tr>
<td class="function_type">
<a class="link" href="glib-Basic-Types.html#gboolean" title="gboolean"><span class="returnvalue">gboolean</span></a>
</td>
<td class="function_name">
<a class="link" href="glib-Perl-compatible-regular-expressions.html#g-regex-match-all-full" title="g_regex_match_all_full ()">g_regex_match_all_full</a> <span class="c_punctuation">()</span>
</td>
</tr>
<tr>
<td class="function_type">
<a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="returnvalue">gchar</span></a> **
</td>
<td class="function_name">
<a class="link" href="glib-Perl-compatible-regular-expressions.html#g-regex-split-simple" title="g_regex_split_simple ()">g_regex_split_simple</a> <span class="c_punctuation">()</span>
</td>
</tr>
<tr>
<td class="function_type">
<a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="returnvalue">gchar</span></a> **
</td>
<td class="function_name">
<a class="link" href="glib-Perl-compatible-regular-expressions.html#g-regex-split" title="g_regex_split ()">g_regex_split</a> <span class="c_punctuation">()</span>
</td>
</tr>
<tr>
<td class="function_type">
<a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="returnvalue">gchar</span></a> **
</td>
<td class="function_name">
<a class="link" href="glib-Perl-compatible-regular-expressions.html#g-regex-split-full" title="g_regex_split_full ()">g_regex_split_full</a> <span class="c_punctuation">()</span>
</td>
</tr>
<tr>
<td class="function_type">
<a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="returnvalue">gchar</span></a> *
</td>
<td class="function_name">
<a class="link" href="glib-Perl-compatible-regular-expressions.html#g-regex-replace" title="g_regex_replace ()">g_regex_replace</a> <span class="c_punctuation">()</span>
</td>
</tr>
<tr>
<td class="function_type">
<a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="returnvalue">gchar</span></a> *
</td>
<td class="function_name">
<a class="link" href="glib-Perl-compatible-regular-expressions.html#g-regex-replace-literal" title="g_regex_replace_literal ()">g_regex_replace_literal</a> <span class="c_punctuation">()</span>
</td>
</tr>
<tr>
<td class="function_type">
<a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="returnvalue">gchar</span></a> *
</td>
<td class="function_name">
<a class="link" href="glib-Perl-compatible-regular-expressions.html#g-regex-replace-eval" title="g_regex_replace_eval ()">g_regex_replace_eval</a> <span class="c_punctuation">()</span>
</td>
</tr>
<tr>
<td class="function_type">
<a class="link" href="glib-Basic-Types.html#gboolean" title="gboolean"><span class="returnvalue">gboolean</span></a>
</td>
<td class="function_name">
<a class="link" href="glib-Perl-compatible-regular-expressions.html#g-regex-check-replacement" title="g_regex_check_replacement ()">g_regex_check_replacement</a> <span class="c_punctuation">()</span>
</td>
</tr>
<tr>
<td class="function_type">
<a class="link" href="glib-Perl-compatible-regular-expressions.html#GRegex" title="GRegex"><span class="returnvalue">GRegex</span></a> *
</td>
<td class="function_name">
<a class="link" href="glib-Perl-compatible-regular-expressions.html#g-match-info-get-regex" title="g_match_info_get_regex ()">g_match_info_get_regex</a> <span class="c_punctuation">()</span>
</td>
</tr>
<tr>
<td class="function_type">const <a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="returnvalue">gchar</span></a> *
</td>
<td class="function_name">
<a class="link" href="glib-Perl-compatible-regular-expressions.html#g-match-info-get-string" title="g_match_info_get_string ()">g_match_info_get_string</a> <span class="c_punctuation">()</span>
</td>
</tr>
<tr>
<td class="function_type">
<a class="link" href="glib-Perl-compatible-regular-expressions.html#GMatchInfo" title="GMatchInfo"><span class="returnvalue">GMatchInfo</span></a> *
</td>
<td class="function_name">
<a class="link" href="glib-Perl-compatible-regular-expressions.html#g-match-info-ref" title="g_match_info_ref ()">g_match_info_ref</a> <span class="c_punctuation">()</span>
</td>
</tr>
<tr>
<td class="function_type">
<span class="returnvalue">void</span>
</td>
<td class="function_name">
<a class="link" href="glib-Perl-compatible-regular-expressions.html#g-match-info-unref" title="g_match_info_unref ()">g_match_info_unref</a> <span class="c_punctuation">()</span>
</td>
</tr>
<tr>
<td class="function_type">
<span class="returnvalue">void</span>
</td>
<td class="function_name">
<a class="link" href="glib-Perl-compatible-regular-expressions.html#g-match-info-free" title="g_match_info_free ()">g_match_info_free</a> <span class="c_punctuation">()</span>
</td>
</tr>
<tr>
<td class="function_type">
<a class="link" href="glib-Basic-Types.html#gboolean" title="gboolean"><span class="returnvalue">gboolean</span></a>
</td>
<td class="function_name">
<a class="link" href="glib-Perl-compatible-regular-expressions.html#g-match-info-matches" title="g_match_info_matches ()">g_match_info_matches</a> <span class="c_punctuation">()</span>
</td>
</tr>
<tr>
<td class="function_type">
<a class="link" href="glib-Basic-Types.html#gboolean" title="gboolean"><span class="returnvalue">gboolean</span></a>
</td>
<td class="function_name">
<a class="link" href="glib-Perl-compatible-regular-expressions.html#g-match-info-next" title="g_match_info_next ()">g_match_info_next</a> <span class="c_punctuation">()</span>
</td>
</tr>
<tr>
<td class="function_type">
<a class="link" href="glib-Basic-Types.html#gint" title="gint ()"><span class="returnvalue">gint</span></a>
</td>
<td class="function_name">
<a class="link" href="glib-Perl-compatible-regular-expressions.html#g-match-info-get-match-count" title="g_match_info_get_match_count ()">g_match_info_get_match_count</a> <span class="c_punctuation">()</span>
</td>
</tr>
<tr>
<td class="function_type">
<a class="link" href="glib-Basic-Types.html#gboolean" title="gboolean"><span class="returnvalue">gboolean</span></a>
</td>
<td class="function_name">
<a class="link" href="glib-Perl-compatible-regular-expressions.html#g-match-info-is-partial-match" title="g_match_info_is_partial_match ()">g_match_info_is_partial_match</a> <span class="c_punctuation">()</span>
</td>
</tr>
<tr>
<td class="function_type">
<a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="returnvalue">gchar</span></a> *
</td>
<td class="function_name">
<a class="link" href="glib-Perl-compatible-regular-expressions.html#g-match-info-expand-references" title="g_match_info_expand_references ()">g_match_info_expand_references</a> <span class="c_punctuation">()</span>
</td>
</tr>
<tr>
<td class="function_type">
<a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="returnvalue">gchar</span></a> *
</td>
<td class="function_name">
<a class="link" href="glib-Perl-compatible-regular-expressions.html#g-match-info-fetch" title="g_match_info_fetch ()">g_match_info_fetch</a> <span class="c_punctuation">()</span>
</td>
</tr>
<tr>
<td class="function_type">
<a class="link" href="glib-Basic-Types.html#gboolean" title="gboolean"><span class="returnvalue">gboolean</span></a>
</td>
<td class="function_name">
<a class="link" href="glib-Perl-compatible-regular-expressions.html#g-match-info-fetch-pos" title="g_match_info_fetch_pos ()">g_match_info_fetch_pos</a> <span class="c_punctuation">()</span>
</td>
</tr>
<tr>
<td class="function_type">
<a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="returnvalue">gchar</span></a> *
</td>
<td class="function_name">
<a class="link" href="glib-Perl-compatible-regular-expressions.html#g-match-info-fetch-named" title="g_match_info_fetch_named ()">g_match_info_fetch_named</a> <span class="c_punctuation">()</span>
</td>
</tr>
<tr>
<td class="function_type">
<a class="link" href="glib-Basic-Types.html#gboolean" title="gboolean"><span class="returnvalue">gboolean</span></a>
</td>
<td class="function_name">
<a class="link" href="glib-Perl-compatible-regular-expressions.html#g-match-info-fetch-named-pos" title="g_match_info_fetch_named_pos ()">g_match_info_fetch_named_pos</a> <span class="c_punctuation">()</span>
</td>
</tr>
<tr>
<td class="function_type">
<a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="returnvalue">gchar</span></a> **
</td>
<td class="function_name">
<a class="link" href="glib-Perl-compatible-regular-expressions.html#g-match-info-fetch-all" title="g_match_info_fetch_all ()">g_match_info_fetch_all</a> <span class="c_punctuation">()</span>
</td>
</tr>
</tbody>
</table></div>
</div>
<div class="refsect1">
<a name="glib-Perl-compatible-regular-expressions.other"></a><h2>Types and Values</h2>
<div class="informaltable"><table class="informaltable" width="100%" border="0">
<colgroup>
<col width="150px" class="name">
<col class="description">
</colgroup>
<tbody>
<tr>
<td class="datatype_keyword">enum</td>
<td class="function_name"><a class="link" href="glib-Perl-compatible-regular-expressions.html#GRegexError" title="enum GRegexError">GRegexError</a></td>
</tr>
<tr>
<td class="define_keyword">#define</td>
<td class="function_name"><a class="link" href="glib-Perl-compatible-regular-expressions.html#G-REGEX-ERROR:CAPS" title="G_REGEX_ERROR">G_REGEX_ERROR</a></td>
</tr>
<tr>
<td class="datatype_keyword">enum</td>
<td class="function_name"><a class="link" href="glib-Perl-compatible-regular-expressions.html#GRegexCompileFlags" title="enum GRegexCompileFlags">GRegexCompileFlags</a></td>
</tr>
<tr>
<td class="datatype_keyword">enum</td>
<td class="function_name"><a class="link" href="glib-Perl-compatible-regular-expressions.html#GRegexMatchFlags" title="enum GRegexMatchFlags">GRegexMatchFlags</a></td>
</tr>
<tr>
<td class="datatype_keyword"> </td>
<td class="function_name"><a class="link" href="glib-Perl-compatible-regular-expressions.html#GRegex" title="GRegex">GRegex</a></td>
</tr>
<tr>
<td class="datatype_keyword"> </td>
<td class="function_name"><a class="link" href="glib-Perl-compatible-regular-expressions.html#GMatchInfo" title="GMatchInfo">GMatchInfo</a></td>
</tr>
</tbody>
</table></div>
</div>
<div class="refsect1">
<a name="glib-Perl-compatible-regular-expressions.includes"></a><h2>Includes</h2>
<pre class="synopsis">#include &lt;glib.h&gt;
</pre>
</div>
<div class="refsect1">
<a name="glib-Perl-compatible-regular-expressions.description"></a><h2>Description</h2>
<p>The g_regex_*() functions implement regular
expression pattern matching using syntax and semantics similar to
Perl regular expression.</p>
<p>Some functions accept a <em class="parameter"><code>start_position</code></em>
 argument, setting it differs
from just passing over a shortened string and setting <a class="link" href="glib-Perl-compatible-regular-expressions.html#G-REGEX-MATCH-NOTBOL:CAPS"><span class="type">G_REGEX_MATCH_NOTBOL</span></a>
in the case of a pattern that begins with any kind of lookbehind assertion.
For example, consider the pattern "\Biss\B" which finds occurrences of "iss"
in the middle of words. ("\B" matches only if the current position in the
subject is not a word boundary.) When applied to the string "Mississipi"
from the fourth byte, namely "issipi", it does not match, because "\B" is
always false at the start of the subject, which is deemed to be a word
boundary. However, if the entire string is passed , but with
<em class="parameter"><code>start_position</code></em>
 set to 4, it finds the second occurrence of "iss" because
it is able to look behind the starting point to discover that it is
preceded by a letter.</p>
<p>Note that, unless you set the <a class="link" href="glib-Perl-compatible-regular-expressions.html#G-REGEX-RAW:CAPS"><span class="type">G_REGEX_RAW</span></a> flag, all the strings passed
to these functions must be encoded in UTF-8. The lengths and the positions
inside the strings are in bytes and not in characters, so, for instance,
"\xc3\xa0" (i.e. "à") is two bytes long but it is treated as a
single character. If you set <a class="link" href="glib-Perl-compatible-regular-expressions.html#G-REGEX-RAW:CAPS"><span class="type">G_REGEX_RAW</span></a> the strings can be non-valid
UTF-8 strings and a byte is treated as a character, so "\xc3\xa0" is two
bytes and two characters long.</p>
<p>When matching a pattern, "\n" matches only against a "\n" character in
the string, and "\r" matches only a "\r" character. To match any newline
sequence use "\R". This particular group matches either the two-character
sequence CR + LF ("\r\n"), or one of the single characters LF (linefeed,
U+000A, "\n"), VT vertical tab, U+000B, "\v"), FF (formfeed, U+000C, "\f"),
CR (carriage return, U+000D, "\r"), NEL (next line, U+0085), LS (line
separator, U+2028), or PS (paragraph separator, U+2029).</p>
<p>The behaviour of the dot, circumflex, and dollar metacharacters are
affected by newline characters, the default is to recognize any newline
character (the same characters recognized by "\R"). This can be changed
with <a class="link" href="glib-Perl-compatible-regular-expressions.html#G-REGEX-NEWLINE-CR:CAPS"><span class="type">G_REGEX_NEWLINE_CR</span></a>, <a class="link" href="glib-Perl-compatible-regular-expressions.html#G-REGEX-NEWLINE-LF:CAPS"><span class="type">G_REGEX_NEWLINE_LF</span></a> and <a class="link" href="glib-Perl-compatible-regular-expressions.html#G-REGEX-NEWLINE-CRLF:CAPS"><span class="type">G_REGEX_NEWLINE_CRLF</span></a>
compile options, and with <a class="link" href="glib-Perl-compatible-regular-expressions.html#G-REGEX-MATCH-NEWLINE-ANY:CAPS"><span class="type">G_REGEX_MATCH_NEWLINE_ANY</span></a>,
<a class="link" href="glib-Perl-compatible-regular-expressions.html#G-REGEX-MATCH-NEWLINE-CR:CAPS"><span class="type">G_REGEX_MATCH_NEWLINE_CR</span></a>, <a class="link" href="glib-Perl-compatible-regular-expressions.html#G-REGEX-MATCH-NEWLINE-LF:CAPS"><span class="type">G_REGEX_MATCH_NEWLINE_LF</span></a> and
<a class="link" href="glib-Perl-compatible-regular-expressions.html#G-REGEX-MATCH-NEWLINE-CRLF:CAPS"><span class="type">G_REGEX_MATCH_NEWLINE_CRLF</span></a> match options. These settings are also
relevant when compiling a pattern if <a class="link" href="glib-Perl-compatible-regular-expressions.html#G-REGEX-EXTENDED:CAPS"><span class="type">G_REGEX_EXTENDED</span></a> is set, and an
unescaped "#" outside a character class is encountered. This indicates
a comment that lasts until after the next newline.</p>
<p>When setting the <a class="link" href="glib-Perl-compatible-regular-expressions.html#G-REGEX-JAVASCRIPT-COMPAT:CAPS"><code class="literal">G_REGEX_JAVASCRIPT_COMPAT</code></a> flag, pattern syntax and pattern
matching is changed to be compatible with the way that regular expressions
work in JavaScript. More precisely, a lonely ']' character in the pattern
is a syntax error; the '\x' escape only allows 0 to 2 hexadecimal digits, and
you must use the '\u' escape sequence with 4 hex digits to specify a unicode
codepoint instead of '\x' or 'x{....}'. If '\x' or '\u' are not followed by
the specified number of hex digits, they match 'x' and 'u' literally; also
'\U' always matches 'U' instead of being an error in the pattern. Finally,
pattern matching is modified so that back references to an unset subpattern
group produces a match with the empty string instead of an error. See
pcreapi(3) for more information.</p>
<p>Creating and manipulating the same <a class="link" href="glib-Perl-compatible-regular-expressions.html#GRegex" title="GRegex"><span class="type">GRegex</span></a> structure from different
threads is not a problem as <a class="link" href="glib-Perl-compatible-regular-expressions.html#GRegex" title="GRegex"><span class="type">GRegex</span></a> does not modify its internal
state between creation and destruction, on the other hand <a class="link" href="glib-Perl-compatible-regular-expressions.html#GMatchInfo" title="GMatchInfo"><span class="type">GMatchInfo</span></a>
is not threadsafe.</p>
<p>The regular expressions low-level functionalities are obtained through
the excellent
<a class="ulink" href="http://www.pcre.org/" target="_top">PCRE</a>
library written by Philip Hazel.</p>
</div>
<div class="refsect1">
<a name="glib-Perl-compatible-regular-expressions.functions_details"></a><h2>Functions</h2>
<div class="refsect2">
<a name="GRegexEvalCallback"></a><h3>GRegexEvalCallback ()</h3>
<pre class="programlisting"><a class="link" href="glib-Basic-Types.html#gboolean" title="gboolean"><span class="returnvalue">gboolean</span></a>
<span class="c_punctuation">(</span>*GRegexEvalCallback<span class="c_punctuation">)</span> (<em class="parameter"><code>const <a class="link" href="glib-Perl-compatible-regular-expressions.html#GMatchInfo" title="GMatchInfo"><span class="type">GMatchInfo</span></a> *match_info</code></em>,
                       <em class="parameter"><code><a class="link" href="glib-Strings.html#GString" title="struct GString"><span class="type">GString</span></a> *result</code></em>,
                       <em class="parameter"><code><a class="link" href="glib-Basic-Types.html#gpointer" title="gpointer"><span class="type">gpointer</span></a> user_data</code></em>);</pre>
<p>Specifies the type of the function passed to <a class="link" href="glib-Perl-compatible-regular-expressions.html#g-regex-replace-eval" title="g_regex_replace_eval ()"><code class="function">g_regex_replace_eval()</code></a>.
It is called for each occurrence of the pattern in the string passed
to <a class="link" href="glib-Perl-compatible-regular-expressions.html#g-regex-replace-eval" title="g_regex_replace_eval ()"><code class="function">g_regex_replace_eval()</code></a>, and it should append the replacement to
<em class="parameter"><code>result</code></em>
.</p>
<div class="refsect3">
<a name="GRegexEvalCallback.parameters"></a><h4>Parameters</h4>
<div class="informaltable"><table class="informaltable" width="100%" border="0">
<colgroup>
<col width="150px" class="parameters_name">
<col class="parameters_description">
<col width="200px" class="parameters_annotations">
</colgroup>
<tbody>
<tr>
<td class="parameter_name"><p>match_info</p></td>
<td class="parameter_description"><p>the <a class="link" href="glib-Perl-compatible-regular-expressions.html#GMatchInfo" title="GMatchInfo"><span class="type">GMatchInfo</span></a> generated by the match.
Use <a class="link" href="glib-Perl-compatible-regular-expressions.html#g-match-info-get-regex" title="g_match_info_get_regex ()"><code class="function">g_match_info_get_regex()</code></a> and <a class="link" href="glib-Perl-compatible-regular-expressions.html#g-match-info-get-string" title="g_match_info_get_string ()"><code class="function">g_match_info_get_string()</code></a> if you
need the <a class="link" href="glib-Perl-compatible-regular-expressions.html#GRegex" title="GRegex"><span class="type">GRegex</span></a> or the matched string.</p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>result</p></td>
<td class="parameter_description"><p>a <a class="link" href="glib-Strings.html#GString" title="struct GString"><span class="type">GString</span></a> containing the new string</p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>user_data</p></td>
<td class="parameter_description"><p>user data passed to <a class="link" href="glib-Perl-compatible-regular-expressions.html#g-regex-replace-eval" title="g_regex_replace_eval ()"><code class="function">g_regex_replace_eval()</code></a></p></td>
<td class="parameter_annotations"> </td>
</tr>
</tbody>
</table></div>
</div>
<div class="refsect3">
<a name="GRegexEvalCallback.returns"></a><h4>Returns</h4>
<p> <a class="link" href="glib-Standard-Macros.html#FALSE:CAPS" title="FALSE"><code class="literal">FALSE</code></a> to continue the replacement process, <a class="link" href="glib-Standard-Macros.html#TRUE:CAPS" title="TRUE"><code class="literal">TRUE</code></a> to stop it</p>
</div>
<p class="since">Since: <a class="link" href="api-index-2-14.html#api-index-2.14">2.14</a></p>
</div>
<hr>
<div class="refsect2">
<a name="g-regex-new"></a><h3>g_regex_new ()</h3>
<pre class="programlisting"><a class="link" href="glib-Perl-compatible-regular-expressions.html#GRegex" title="GRegex"><span class="returnvalue">GRegex</span></a> *
g_regex_new (<em class="parameter"><code>const <a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="type">gchar</span></a> *pattern</code></em>,
             <em class="parameter"><code><a class="link" href="glib-Perl-compatible-regular-expressions.html#GRegexCompileFlags" title="enum GRegexCompileFlags"><span class="type">GRegexCompileFlags</span></a> compile_options</code></em>,
             <em class="parameter"><code><a class="link" href="glib-Perl-compatible-regular-expressions.html#GRegexMatchFlags" title="enum GRegexMatchFlags"><span class="type">GRegexMatchFlags</span></a> match_options</code></em>,
             <em class="parameter"><code><a class="link" href="glib-Error-Reporting.html#GError" title="struct GError"><span class="type">GError</span></a> **error</code></em>);</pre>
<p>Compiles the regular expression to an internal form, and does
the initial setup of the <a class="link" href="glib-Perl-compatible-regular-expressions.html#GRegex" title="GRegex"><span class="type">GRegex</span></a> structure.</p>
<div class="refsect3">
<a name="g-regex-new.parameters"></a><h4>Parameters</h4>
<div class="informaltable"><table class="informaltable" width="100%" border="0">
<colgroup>
<col width="150px" class="parameters_name">
<col class="parameters_description">
<col width="200px" class="parameters_annotations">
</colgroup>
<tbody>
<tr>
<td class="parameter_name"><p>pattern</p></td>
<td class="parameter_description"><p>the regular expression</p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>compile_options</p></td>
<td class="parameter_description"><p>compile options for the regular expression, or 0</p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>match_options</p></td>
<td class="parameter_description"><p>match options for the regular expression, or 0</p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>error</p></td>
<td class="parameter_description"><p>return location for a <a class="link" href="glib-Error-Reporting.html#GError" title="struct GError"><span class="type">GError</span></a></p></td>
<td class="parameter_annotations"> </td>
</tr>
</tbody>
</table></div>
</div>
<div class="refsect3">
<a name="g-regex-new.returns"></a><h4>Returns</h4>
<p> a <a class="link" href="glib-Perl-compatible-regular-expressions.html#GRegex" title="GRegex"><span class="type">GRegex</span></a> structure or <a class="link" href="glib-Standard-Macros.html#NULL:CAPS" title="NULL"><code class="literal">NULL</code></a> if an error occured. Call
<a class="link" href="glib-Perl-compatible-regular-expressions.html#g-regex-unref" title="g_regex_unref ()"><code class="function">g_regex_unref()</code></a> when you are done with it. </p>
<p><span class="annotation">[<acronym title="NULL may be passed as the value in, out, in-out; or as a return value."><span class="acronym">nullable</span></acronym>]</span></p>
</div>
<p class="since">Since: <a class="link" href="api-index-2-14.html#api-index-2.14">2.14</a></p>
</div>
<hr>
<div class="refsect2">
<a name="g-regex-ref"></a><h3>g_regex_ref ()</h3>
<pre class="programlisting"><a class="link" href="glib-Perl-compatible-regular-expressions.html#GRegex" title="GRegex"><span class="returnvalue">GRegex</span></a> *
g_regex_ref (<em class="parameter"><code><a class="link" href="glib-Perl-compatible-regular-expressions.html#GRegex" title="GRegex"><span class="type">GRegex</span></a> *regex</code></em>);</pre>
<p>Increases reference count of <em class="parameter"><code>regex</code></em>
 by 1.</p>
<div class="refsect3">
<a name="g-regex-ref.parameters"></a><h4>Parameters</h4>
<div class="informaltable"><table class="informaltable" width="100%" border="0">
<colgroup>
<col width="150px" class="parameters_name">
<col class="parameters_description">
<col width="200px" class="parameters_annotations">
</colgroup>
<tbody><tr>
<td class="parameter_name"><p>regex</p></td>
<td class="parameter_description"><p>a <a class="link" href="glib-Perl-compatible-regular-expressions.html#GRegex" title="GRegex"><span class="type">GRegex</span></a></p></td>
<td class="parameter_annotations"> </td>
</tr></tbody>
</table></div>
</div>
<div class="refsect3">
<a name="g-regex-ref.returns"></a><h4>Returns</h4>
<p> <em class="parameter"><code>regex</code></em>
</p>
</div>
<p class="since">Since: <a class="link" href="api-index-2-14.html#api-index-2.14">2.14</a></p>
</div>
<hr>
<div class="refsect2">
<a name="g-regex-unref"></a><h3>g_regex_unref ()</h3>
<pre class="programlisting"><span class="returnvalue">void</span>
g_regex_unref (<em class="parameter"><code><a class="link" href="glib-Perl-compatible-regular-expressions.html#GRegex" title="GRegex"><span class="type">GRegex</span></a> *regex</code></em>);</pre>
<p>Decreases reference count of <em class="parameter"><code>regex</code></em>
 by 1. When reference count drops
to zero, it frees all the memory associated with the regex structure.</p>
<div class="refsect3">
<a name="g-regex-unref.parameters"></a><h4>Parameters</h4>
<div class="informaltable"><table class="informaltable" width="100%" border="0">
<colgroup>
<col width="150px" class="parameters_name">
<col class="parameters_description">
<col width="200px" class="parameters_annotations">
</colgroup>
<tbody><tr>
<td class="parameter_name"><p>regex</p></td>
<td class="parameter_description"><p>a <a class="link" href="glib-Perl-compatible-regular-expressions.html#GRegex" title="GRegex"><span class="type">GRegex</span></a></p></td>
<td class="parameter_annotations"> </td>
</tr></tbody>
</table></div>
</div>
<p class="since">Since: <a class="link" href="api-index-2-14.html#api-index-2.14">2.14</a></p>
</div>
<hr>
<div class="refsect2">
<a name="g-regex-get-pattern"></a><h3>g_regex_get_pattern ()</h3>
<pre class="programlisting">const <a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="returnvalue">gchar</span></a> *
g_regex_get_pattern (<em class="parameter"><code>const <a class="link" href="glib-Perl-compatible-regular-expressions.html#GRegex" title="GRegex"><span class="type">GRegex</span></a> *regex</code></em>);</pre>
<p>Gets the pattern string associated with <em class="parameter"><code>regex</code></em>
, i.e. a copy of
the string passed to <a class="link" href="glib-Perl-compatible-regular-expressions.html#g-regex-new" title="g_regex_new ()"><code class="function">g_regex_new()</code></a>.</p>
<div class="refsect3">
<a name="g-regex-get-pattern.parameters"></a><h4>Parameters</h4>
<div class="informaltable"><table class="informaltable" width="100%" border="0">
<colgroup>
<col width="150px" class="parameters_name">
<col class="parameters_description">
<col width="200px" class="parameters_annotations">
</colgroup>
<tbody><tr>
<td class="parameter_name"><p>regex</p></td>
<td class="parameter_description"><p>a <a class="link" href="glib-Perl-compatible-regular-expressions.html#GRegex" title="GRegex"><span class="type">GRegex</span></a> structure</p></td>
<td class="parameter_annotations"> </td>
</tr></tbody>
</table></div>
</div>
<div class="refsect3">
<a name="g-regex-get-pattern.returns"></a><h4>Returns</h4>
<p> the pattern of <em class="parameter"><code>regex</code></em>
</p>
</div>
<p class="since">Since: <a class="link" href="api-index-2-14.html#api-index-2.14">2.14</a></p>
</div>
<hr>
<div class="refsect2">
<a name="g-regex-get-max-backref"></a><h3>g_regex_get_max_backref ()</h3>
<pre class="programlisting"><a class="link" href="glib-Basic-Types.html#gint" title="gint ()"><span class="returnvalue">gint</span></a>
g_regex_get_max_backref (<em class="parameter"><code>const <a class="link" href="glib-Perl-compatible-regular-expressions.html#GRegex" title="GRegex"><span class="type">GRegex</span></a> *regex</code></em>);</pre>
<p>Returns the number of the highest back reference
in the pattern, or 0 if the pattern does not contain
back references.</p>
<div class="refsect3">
<a name="g-regex-get-max-backref.parameters"></a><h4>Parameters</h4>
<div class="informaltable"><table class="informaltable" width="100%" border="0">
<colgroup>
<col width="150px" class="parameters_name">
<col class="parameters_description">
<col width="200px" class="parameters_annotations">
</colgroup>
<tbody><tr>
<td class="parameter_name"><p>regex</p></td>
<td class="parameter_description"><p>a <a class="link" href="glib-Perl-compatible-regular-expressions.html#GRegex" title="GRegex"><span class="type">GRegex</span></a></p></td>
<td class="parameter_annotations"> </td>
</tr></tbody>
</table></div>
</div>
<div class="refsect3">
<a name="g-regex-get-max-backref.returns"></a><h4>Returns</h4>
<p> the number of the highest back reference</p>
</div>
<p class="since">Since: <a class="link" href="api-index-2-14.html#api-index-2.14">2.14</a></p>
</div>
<hr>
<div class="refsect2">
<a name="g-regex-get-capture-count"></a><h3>g_regex_get_capture_count ()</h3>
<pre class="programlisting"><a class="link" href="glib-Basic-Types.html#gint" title="gint ()"><span class="returnvalue">gint</span></a>
g_regex_get_capture_count (<em class="parameter"><code>const <a class="link" href="glib-Perl-compatible-regular-expressions.html#GRegex" title="GRegex"><span class="type">GRegex</span></a> *regex</code></em>);</pre>
<p>Returns the number of capturing subpatterns in the pattern.</p>
<div class="refsect3">
<a name="g-regex-get-capture-count.parameters"></a><h4>Parameters</h4>
<div class="informaltable"><table class="informaltable" width="100%" border="0">
<colgroup>
<col width="150px" class="parameters_name">
<col class="parameters_description">
<col width="200px" class="parameters_annotations">
</colgroup>
<tbody><tr>
<td class="parameter_name"><p>regex</p></td>
<td class="parameter_description"><p>a <a class="link" href="glib-Perl-compatible-regular-expressions.html#GRegex" title="GRegex"><span class="type">GRegex</span></a></p></td>
<td class="parameter_annotations"> </td>
</tr></tbody>
</table></div>
</div>
<div class="refsect3">
<a name="g-regex-get-capture-count.returns"></a><h4>Returns</h4>
<p> the number of capturing subpatterns</p>
</div>
<p class="since">Since: <a class="link" href="api-index-2-14.html#api-index-2.14">2.14</a></p>
</div>
<hr>
<div class="refsect2">
<a name="g-regex-get-has-cr-or-lf"></a><h3>g_regex_get_has_cr_or_lf ()</h3>
<pre class="programlisting"><a class="link" href="glib-Basic-Types.html#gboolean" title="gboolean"><span class="returnvalue">gboolean</span></a>
g_regex_get_has_cr_or_lf (<em class="parameter"><code>const <a class="link" href="glib-Perl-compatible-regular-expressions.html#GRegex" title="GRegex"><span class="type">GRegex</span></a> *regex</code></em>);</pre>
<p>Checks whether the pattern contains explicit CR or LF references.</p>
<div class="refsect3">
<a name="g-regex-get-has-cr-or-lf.parameters"></a><h4>Parameters</h4>
<div class="informaltable"><table class="informaltable" width="100%" border="0">
<colgroup>
<col width="150px" class="parameters_name">
<col class="parameters_description">
<col width="200px" class="parameters_annotations">
</colgroup>
<tbody><tr>
<td class="parameter_name"><p>regex</p></td>
<td class="parameter_description"><p>a <a class="link" href="glib-Perl-compatible-regular-expressions.html#GRegex" title="GRegex"><span class="type">GRegex</span></a> structure</p></td>
<td class="parameter_annotations"> </td>
</tr></tbody>
</table></div>
</div>
<div class="refsect3">
<a name="g-regex-get-has-cr-or-lf.returns"></a><h4>Returns</h4>
<p> <a class="link" href="glib-Standard-Macros.html#TRUE:CAPS" title="TRUE"><code class="literal">TRUE</code></a> if the pattern contains explicit CR or LF references</p>
</div>
<p class="since">Since: <a class="link" href="api-index-2-34.html#api-index-2.34">2.34</a></p>
</div>
<hr>
<div class="refsect2">
<a name="g-regex-get-max-lookbehind"></a><h3>g_regex_get_max_lookbehind ()</h3>
<pre class="programlisting"><a class="link" href="glib-Basic-Types.html#gint" title="gint ()"><span class="returnvalue">gint</span></a>
g_regex_get_max_lookbehind (<em class="parameter"><code>const <a class="link" href="glib-Perl-compatible-regular-expressions.html#GRegex" title="GRegex"><span class="type">GRegex</span></a> *regex</code></em>);</pre>
<p>Gets the number of characters in the longest lookbehind assertion in the
pattern. This information is useful when doing multi-segment matching using
the partial matching facilities.</p>
<div class="refsect3">
<a name="g-regex-get-max-lookbehind.parameters"></a><h4>Parameters</h4>
<div class="informaltable"><table class="informaltable" width="100%" border="0">
<colgroup>
<col width="150px" class="parameters_name">
<col class="parameters_description">
<col width="200px" class="parameters_annotations">
</colgroup>
<tbody><tr>
<td class="parameter_name"><p>regex</p></td>
<td class="parameter_description"><p>a <a class="link" href="glib-Perl-compatible-regular-expressions.html#GRegex" title="GRegex"><span class="type">GRegex</span></a> structure</p></td>
<td class="parameter_annotations"> </td>
</tr></tbody>
</table></div>
</div>
<div class="refsect3">
<a name="g-regex-get-max-lookbehind.returns"></a><h4>Returns</h4>
<p> the number of characters in the longest lookbehind assertion.</p>
</div>
<p class="since">Since: <a class="link" href="api-index-2-38.html#api-index-2.38">2.38</a></p>
</div>
<hr>
<div class="refsect2">
<a name="g-regex-get-string-number"></a><h3>g_regex_get_string_number ()</h3>
<pre class="programlisting"><a class="link" href="glib-Basic-Types.html#gint" title="gint ()"><span class="returnvalue">gint</span></a>
g_regex_get_string_number (<em class="parameter"><code>const <a class="link" href="glib-Perl-compatible-regular-expressions.html#GRegex" title="GRegex"><span class="type">GRegex</span></a> *regex</code></em>,
                           <em class="parameter"><code>const <a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="type">gchar</span></a> *name</code></em>);</pre>
<p>Retrieves the number of the subexpression named <em class="parameter"><code>name</code></em>
.</p>
<div class="refsect3">
<a name="g-regex-get-string-number.parameters"></a><h4>Parameters</h4>
<div class="informaltable"><table class="informaltable" width="100%" border="0">
<colgroup>
<col width="150px" class="parameters_name">
<col class="parameters_description">
<col width="200px" class="parameters_annotations">
</colgroup>
<tbody>
<tr>
<td class="parameter_name"><p>regex</p></td>
<td class="parameter_description"><p><a class="link" href="glib-Perl-compatible-regular-expressions.html#GRegex" title="GRegex"><span class="type">GRegex</span></a> structure</p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>name</p></td>
<td class="parameter_description"><p>name of the subexpression</p></td>
<td class="parameter_annotations"> </td>
</tr>
</tbody>
</table></div>
</div>
<div class="refsect3">
<a name="g-regex-get-string-number.returns"></a><h4>Returns</h4>
<p> The number of the subexpression or -1 if <em class="parameter"><code>name</code></em>
does not exists</p>
</div>
<p class="since">Since: <a class="link" href="api-index-2-14.html#api-index-2.14">2.14</a></p>
</div>
<hr>
<div class="refsect2">
<a name="g-regex-get-compile-flags"></a><h3>g_regex_get_compile_flags ()</h3>
<pre class="programlisting"><a class="link" href="glib-Perl-compatible-regular-expressions.html#GRegexCompileFlags" title="enum GRegexCompileFlags"><span class="returnvalue">GRegexCompileFlags</span></a>
g_regex_get_compile_flags (<em class="parameter"><code>const <a class="link" href="glib-Perl-compatible-regular-expressions.html#GRegex" title="GRegex"><span class="type">GRegex</span></a> *regex</code></em>);</pre>
<p>Returns the compile options that <em class="parameter"><code>regex</code></em>
 was created with.</p>
<div class="refsect3">
<a name="g-regex-get-compile-flags.parameters"></a><h4>Parameters</h4>
<div class="informaltable"><table class="informaltable" width="100%" border="0">
<colgroup>
<col width="150px" class="parameters_name">
<col class="parameters_description">
<col width="200px" class="parameters_annotations">
</colgroup>
<tbody><tr>
<td class="parameter_name"><p>regex</p></td>
<td class="parameter_description"><p>a <a class="link" href="glib-Perl-compatible-regular-expressions.html#GRegex" title="GRegex"><span class="type">GRegex</span></a></p></td>
<td class="parameter_annotations"> </td>
</tr></tbody>
</table></div>
</div>
<div class="refsect3">
<a name="g-regex-get-compile-flags.returns"></a><h4>Returns</h4>
<p> flags from <a class="link" href="glib-Perl-compatible-regular-expressions.html#GRegexCompileFlags" title="enum GRegexCompileFlags"><span class="type">GRegexCompileFlags</span></a></p>
</div>
<p class="since">Since: <a class="link" href="api-index-2-26.html#api-index-2.26">2.26</a></p>
</div>
<hr>
<div class="refsect2">
<a name="g-regex-get-match-flags"></a><h3>g_regex_get_match_flags ()</h3>
<pre class="programlisting"><a class="link" href="glib-Perl-compatible-regular-expressions.html#GRegexMatchFlags" title="enum GRegexMatchFlags"><span class="returnvalue">GRegexMatchFlags</span></a>
g_regex_get_match_flags (<em class="parameter"><code>const <a class="link" href="glib-Perl-compatible-regular-expressions.html#GRegex" title="GRegex"><span class="type">GRegex</span></a> *regex</code></em>);</pre>
<p>Returns the match options that <em class="parameter"><code>regex</code></em>
 was created with.</p>
<div class="refsect3">
<a name="g-regex-get-match-flags.parameters"></a><h4>Parameters</h4>
<div class="informaltable"><table class="informaltable" width="100%" border="0">
<colgroup>
<col width="150px" class="parameters_name">
<col class="parameters_description">
<col width="200px" class="parameters_annotations">
</colgroup>
<tbody><tr>
<td class="parameter_name"><p>regex</p></td>
<td class="parameter_description"><p>a <a class="link" href="glib-Perl-compatible-regular-expressions.html#GRegex" title="GRegex"><span class="type">GRegex</span></a></p></td>
<td class="parameter_annotations"> </td>
</tr></tbody>
</table></div>
</div>
<div class="refsect3">
<a name="g-regex-get-match-flags.returns"></a><h4>Returns</h4>
<p> flags from <a class="link" href="glib-Perl-compatible-regular-expressions.html#GRegexMatchFlags" title="enum GRegexMatchFlags"><span class="type">GRegexMatchFlags</span></a></p>
</div>
<p class="since">Since: <a class="link" href="api-index-2-26.html#api-index-2.26">2.26</a></p>
</div>
<hr>
<div class="refsect2">
<a name="g-regex-escape-string"></a><h3>g_regex_escape_string ()</h3>
<pre class="programlisting"><a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="returnvalue">gchar</span></a> *
g_regex_escape_string (<em class="parameter"><code>const <a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="type">gchar</span></a> *string</code></em>,
                       <em class="parameter"><code><a class="link" href="glib-Basic-Types.html#gint" title="gint ()"><span class="type">gint</span></a> length</code></em>);</pre>
<p>Escapes the special characters used for regular expressions
in <em class="parameter"><code>string</code></em>
, for instance "a.b*c" becomes "a.b*c". This
function is useful to dynamically generate regular expressions.</p>
<p><em class="parameter"><code>string</code></em>
 can contain nul characters that are replaced with "\0",
in this case remember to specify the correct length of <em class="parameter"><code>string</code></em>

in <em class="parameter"><code>length</code></em>
.</p>
<div class="refsect3">
<a name="g-regex-escape-string.parameters"></a><h4>Parameters</h4>
<div class="informaltable"><table class="informaltable" width="100%" border="0">
<colgroup>
<col width="150px" class="parameters_name">
<col class="parameters_description">
<col width="200px" class="parameters_annotations">
</colgroup>
<tbody>
<tr>
<td class="parameter_name"><p>string</p></td>
<td class="parameter_description"><p> the string to escape. </p></td>
<td class="parameter_annotations"><span class="annotation">[<acronym title="Parameter points to an array of items."><span class="acronym">array</span></acronym> length=length]</span></td>
</tr>
<tr>
<td class="parameter_name"><p>length</p></td>
<td class="parameter_description"><p>the length of <em class="parameter"><code>string</code></em>
, or -1 if <em class="parameter"><code>string</code></em>
is nul-terminated</p></td>
<td class="parameter_annotations"> </td>
</tr>
</tbody>
</table></div>
</div>
<div class="refsect3">
<a name="g-regex-escape-string.returns"></a><h4>Returns</h4>
<p> a newly-allocated escaped string</p>
</div>
<p class="since">Since: <a class="link" href="api-index-2-14.html#api-index-2.14">2.14</a></p>
</div>
<hr>
<div class="refsect2">
<a name="g-regex-escape-nul"></a><h3>g_regex_escape_nul ()</h3>
<pre class="programlisting"><a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="returnvalue">gchar</span></a> *
g_regex_escape_nul (<em class="parameter"><code>const <a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="type">gchar</span></a> *string</code></em>,
                    <em class="parameter"><code><a class="link" href="glib-Basic-Types.html#gint" title="gint ()"><span class="type">gint</span></a> length</code></em>);</pre>
<p>Escapes the nul characters in <em class="parameter"><code>string</code></em>
 to "\x00".  It can be used
to compile a regex with embedded nul characters.</p>
<p>For completeness, <em class="parameter"><code>length</code></em>
 can be -1 for a nul-terminated string.
In this case the output string will be of course equal to <em class="parameter"><code>string</code></em>
.</p>
<div class="refsect3">
<a name="g-regex-escape-nul.parameters"></a><h4>Parameters</h4>
<div class="informaltable"><table class="informaltable" width="100%" border="0">
<colgroup>
<col width="150px" class="parameters_name">
<col class="parameters_description">
<col width="200px" class="parameters_annotations">
</colgroup>
<tbody>
<tr>
<td class="parameter_name"><p>string</p></td>
<td class="parameter_description"><p>the string to escape</p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>length</p></td>
<td class="parameter_description"><p>the length of <em class="parameter"><code>string</code></em>
</p></td>
<td class="parameter_annotations"> </td>
</tr>
</tbody>
</table></div>
</div>
<div class="refsect3">
<a name="g-regex-escape-nul.returns"></a><h4>Returns</h4>
<p> a newly-allocated escaped string</p>
</div>
<p class="since">Since: <a class="link" href="api-index-2-30.html#api-index-2.30">2.30</a></p>
</div>
<hr>
<div class="refsect2">
<a name="g-regex-match-simple"></a><h3>g_regex_match_simple ()</h3>
<pre class="programlisting"><a class="link" href="glib-Basic-Types.html#gboolean" title="gboolean"><span class="returnvalue">gboolean</span></a>
g_regex_match_simple (<em class="parameter"><code>const <a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="type">gchar</span></a> *pattern</code></em>,
                      <em class="parameter"><code>const <a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="type">gchar</span></a> *string</code></em>,
                      <em class="parameter"><code><a class="link" href="glib-Perl-compatible-regular-expressions.html#GRegexCompileFlags" title="enum GRegexCompileFlags"><span class="type">GRegexCompileFlags</span></a> compile_options</code></em>,
                      <em class="parameter"><code><a class="link" href="glib-Perl-compatible-regular-expressions.html#GRegexMatchFlags" title="enum GRegexMatchFlags"><span class="type">GRegexMatchFlags</span></a> match_options</code></em>);</pre>
<p>Scans for a match in <em class="parameter"><code>string</code></em>
 for <em class="parameter"><code>pattern</code></em>
.</p>
<p>This function is equivalent to <a class="link" href="glib-Perl-compatible-regular-expressions.html#g-regex-match" title="g_regex_match ()"><code class="function">g_regex_match()</code></a> but it does not
require to compile the pattern with <a class="link" href="glib-Perl-compatible-regular-expressions.html#g-regex-new" title="g_regex_new ()"><code class="function">g_regex_new()</code></a>, avoiding some
lines of code when you need just to do a match without extracting
substrings, capture counts, and so on.</p>
<p>If this function is to be called on the same <em class="parameter"><code>pattern</code></em>
 more than
once, it's more efficient to compile the pattern once with
<a class="link" href="glib-Perl-compatible-regular-expressions.html#g-regex-new" title="g_regex_new ()"><code class="function">g_regex_new()</code></a> and then use <a class="link" href="glib-Perl-compatible-regular-expressions.html#g-regex-match" title="g_regex_match ()"><code class="function">g_regex_match()</code></a>.</p>
<div class="refsect3">
<a name="g-regex-match-simple.parameters"></a><h4>Parameters</h4>
<div class="informaltable"><table class="informaltable" width="100%" border="0">
<colgroup>
<col width="150px" class="parameters_name">
<col class="parameters_description">
<col width="200px" class="parameters_annotations">
</colgroup>
<tbody>
<tr>
<td class="parameter_name"><p>pattern</p></td>
<td class="parameter_description"><p>the regular expression</p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>string</p></td>
<td class="parameter_description"><p>the string to scan for matches</p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>compile_options</p></td>
<td class="parameter_description"><p>compile options for the regular expression, or 0</p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>match_options</p></td>
<td class="parameter_description"><p>match options, or 0</p></td>
<td class="parameter_annotations"> </td>
</tr>
</tbody>
</table></div>
</div>
<div class="refsect3">
<a name="g-regex-match-simple.returns"></a><h4>Returns</h4>
<p> <a class="link" href="glib-Standard-Macros.html#TRUE:CAPS" title="TRUE"><code class="literal">TRUE</code></a> if the string matched, <a class="link" href="glib-Standard-Macros.html#FALSE:CAPS" title="FALSE"><code class="literal">FALSE</code></a> otherwise</p>
</div>
<p class="since">Since: <a class="link" href="api-index-2-14.html#api-index-2.14">2.14</a></p>
</div>
<hr>
<div class="refsect2">
<a name="g-regex-match"></a><h3>g_regex_match ()</h3>
<pre class="programlisting"><a class="link" href="glib-Basic-Types.html#gboolean" title="gboolean"><span class="returnvalue">gboolean</span></a>
g_regex_match (<em class="parameter"><code>const <a class="link" href="glib-Perl-compatible-regular-expressions.html#GRegex" title="GRegex"><span class="type">GRegex</span></a> *regex</code></em>,
               <em class="parameter"><code>const <a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="type">gchar</span></a> *string</code></em>,
               <em class="parameter"><code><a class="link" href="glib-Perl-compatible-regular-expressions.html#GRegexMatchFlags" title="enum GRegexMatchFlags"><span class="type">GRegexMatchFlags</span></a> match_options</code></em>,
               <em class="parameter"><code><a class="link" href="glib-Perl-compatible-regular-expressions.html#GMatchInfo" title="GMatchInfo"><span class="type">GMatchInfo</span></a> **match_info</code></em>);</pre>
<p>Scans for a match in string for the pattern in <em class="parameter"><code>regex</code></em>
.
The <em class="parameter"><code>match_options</code></em>
 are combined with the match options specified
when the <em class="parameter"><code>regex</code></em>
 structure was created, letting you have more
flexibility in reusing <a class="link" href="glib-Perl-compatible-regular-expressions.html#GRegex" title="GRegex"><span class="type">GRegex</span></a> structures.</p>
<p>A <a class="link" href="glib-Perl-compatible-regular-expressions.html#GMatchInfo" title="GMatchInfo"><span class="type">GMatchInfo</span></a> structure, used to get information on the match,
is stored in <em class="parameter"><code>match_info</code></em>
 if not <a class="link" href="glib-Standard-Macros.html#NULL:CAPS" title="NULL"><code class="literal">NULL</code></a>. Note that if <em class="parameter"><code>match_info</code></em>

is not <a class="link" href="glib-Standard-Macros.html#NULL:CAPS" title="NULL"><code class="literal">NULL</code></a> then it is created even if the function returns <a class="link" href="glib-Standard-Macros.html#FALSE:CAPS" title="FALSE"><code class="literal">FALSE</code></a>,
i.e. you must free it regardless if regular expression actually matched.</p>
<p>To retrieve all the non-overlapping matches of the pattern in
string you can use <a class="link" href="glib-Perl-compatible-regular-expressions.html#g-match-info-next" title="g_match_info_next ()"><code class="function">g_match_info_next()</code></a>.</p>
<div class="informalexample">
  <table class="listing_frame" border="0" cellpadding="0" cellspacing="0">
    <tbody>
      <tr>
        <td class="listing_lines" align="right"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19</pre></td>
        <td class="listing_code"><pre class="programlisting"><span class="gtkdoc kwb">static void</span>
<span class="function">print_uppercase_words</span> <span class="gtkdoc opt">(</span><span class="gtkdoc kwb">const</span> gchar <span class="gtkdoc opt">*</span>string<span class="gtkdoc opt">)</span>
<span class="gtkdoc opt">{</span>
  <span class="gtkdoc slc">// Print all uppercase-only words.</span>
  GRegex <span class="gtkdoc opt">*</span>regex<span class="gtkdoc opt">;</span>
  GMatchInfo <span class="gtkdoc opt">*</span>match_info<span class="gtkdoc opt">;</span>
 
  regex <span class="gtkdoc opt">=</span> <span class="function"><a href="glib-Perl-compatible-regular-expressions.html#g-regex-new">g_regex_new</a></span> <span class="gtkdoc opt">(</span><span class="string">&quot;[A-Z]+&quot;</span><span class="gtkdoc opt">,</span> <span class="number">0</span><span class="gtkdoc opt">,</span> <span class="number">0</span><span class="gtkdoc opt">,</span> NULL<span class="gtkdoc opt">);</span>
  <span class="function"><a href="glib-Perl-compatible-regular-expressions.html#g-regex-match">g_regex_match</a></span> <span class="gtkdoc opt">(</span>regex<span class="gtkdoc opt">,</span> string<span class="gtkdoc opt">,</span> <span class="number">0</span><span class="gtkdoc opt">, &amp;</span>match_info<span class="gtkdoc opt">);</span>
  <span class="keyword">while</span> <span class="gtkdoc opt">(</span><span class="function"><a href="glib-Perl-compatible-regular-expressions.html#g-match-info-matches">g_match_info_matches</a></span> <span class="gtkdoc opt">(</span>match_info<span class="gtkdoc opt">))</span>
    <span class="gtkdoc opt">{</span>
      gchar <span class="gtkdoc opt">*</span>word <span class="gtkdoc opt">=</span> <span class="function"><a href="glib-Perl-compatible-regular-expressions.html#g-match-info-fetch">g_match_info_fetch</a></span> <span class="gtkdoc opt">(</span>match_info<span class="gtkdoc opt">,</span> <span class="number">0</span><span class="gtkdoc opt">);</span>
      <span class="function"><a href="glib-Warnings-and-Assertions.html#g-print">g_print</a></span> <span class="gtkdoc opt">(</span><span class="string">&quot;Found: %s</span><span class="gtkdoc esc">\n</span><span class="string">&quot;</span><span class="gtkdoc opt">,</span> word<span class="gtkdoc opt">);</span>
      <span class="function"><a href="glib-Memory-Allocation.html#g-free">g_free</a></span> <span class="gtkdoc opt">(</span>word<span class="gtkdoc opt">);</span>
      <span class="function"><a href="glib-Perl-compatible-regular-expressions.html#g-match-info-next">g_match_info_next</a></span> <span class="gtkdoc opt">(</span>match_info<span class="gtkdoc opt">,</span> NULL<span class="gtkdoc opt">);</span>
    <span class="gtkdoc opt">}</span>
  <span class="function"><a href="glib-Perl-compatible-regular-expressions.html#g-match-info-free">g_match_info_free</a></span> <span class="gtkdoc opt">(</span>match_info<span class="gtkdoc opt">);</span>
  <span class="function"><a href="glib-Perl-compatible-regular-expressions.html#g-regex-unref">g_regex_unref</a></span> <span class="gtkdoc opt">(</span>regex<span class="gtkdoc opt">);</span>
<span class="gtkdoc opt">}</span></pre></td>
      </tr>
    </tbody>
  </table>
</div>

<p></p>
<p><em class="parameter"><code>string</code></em>
 is not copied and is used in <a class="link" href="glib-Perl-compatible-regular-expressions.html#GMatchInfo" title="GMatchInfo"><span class="type">GMatchInfo</span></a> internally. If
you use any <a class="link" href="glib-Perl-compatible-regular-expressions.html#GMatchInfo" title="GMatchInfo"><span class="type">GMatchInfo</span></a> method (except <a class="link" href="glib-Perl-compatible-regular-expressions.html#g-match-info-free" title="g_match_info_free ()"><code class="function">g_match_info_free()</code></a>) after
freeing or modifying <em class="parameter"><code>string</code></em>
 then the behaviour is undefined.</p>
<div class="refsect3">
<a name="g-regex-match.parameters"></a><h4>Parameters</h4>
<div class="informaltable"><table class="informaltable" width="100%" border="0">
<colgroup>
<col width="150px" class="parameters_name">
<col class="parameters_description">
<col width="200px" class="parameters_annotations">
</colgroup>
<tbody>
<tr>
<td class="parameter_name"><p>regex</p></td>
<td class="parameter_description"><p>a <a class="link" href="glib-Perl-compatible-regular-expressions.html#GRegex" title="GRegex"><span class="type">GRegex</span></a> structure from <a class="link" href="glib-Perl-compatible-regular-expressions.html#g-regex-new" title="g_regex_new ()"><code class="function">g_regex_new()</code></a></p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>string</p></td>
<td class="parameter_description"><p>the string to scan for matches</p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>match_options</p></td>
<td class="parameter_description"><p>match options</p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>match_info</p></td>
<td class="parameter_description"><p> pointer to location where to store
the <a class="link" href="glib-Perl-compatible-regular-expressions.html#GMatchInfo" title="GMatchInfo"><span class="type">GMatchInfo</span></a>, or <a class="link" href="glib-Standard-Macros.html#NULL:CAPS" title="NULL"><code class="literal">NULL</code></a> if you do not need it. </p></td>
<td class="parameter_annotations"><span class="annotation">[<acronym title="Parameter for returning results. Default is transfer full."><span class="acronym">out</span></acronym>][<acronym title="NULL is OK, both for passing and for returning."><span class="acronym">allow-none</span></acronym>]</span></td>
</tr>
</tbody>
</table></div>
</div>
<div class="refsect3">
<a name="g-regex-match.returns"></a><h4>Returns</h4>
<p> <a class="link" href="glib-Standard-Macros.html#TRUE:CAPS" title="TRUE"><code class="literal">TRUE</code></a> is the string matched, <a class="link" href="glib-Standard-Macros.html#FALSE:CAPS" title="FALSE"><code class="literal">FALSE</code></a> otherwise</p>
</div>
<p class="since">Since: <a class="link" href="api-index-2-14.html#api-index-2.14">2.14</a></p>
</div>
<hr>
<div class="refsect2">
<a name="g-regex-match-full"></a><h3>g_regex_match_full ()</h3>
<pre class="programlisting"><a class="link" href="glib-Basic-Types.html#gboolean" title="gboolean"><span class="returnvalue">gboolean</span></a>
g_regex_match_full (<em class="parameter"><code>const <a class="link" href="glib-Perl-compatible-regular-expressions.html#GRegex" title="GRegex"><span class="type">GRegex</span></a> *regex</code></em>,
                    <em class="parameter"><code>const <a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="type">gchar</span></a> *string</code></em>,
                    <em class="parameter"><code><a class="link" href="glib-Basic-Types.html#gssize" title="gssize"><span class="type">gssize</span></a> string_len</code></em>,
                    <em class="parameter"><code><a class="link" href="glib-Basic-Types.html#gint" title="gint ()"><span class="type">gint</span></a> start_position</code></em>,
                    <em class="parameter"><code><a class="link" href="glib-Perl-compatible-regular-expressions.html#GRegexMatchFlags" title="enum GRegexMatchFlags"><span class="type">GRegexMatchFlags</span></a> match_options</code></em>,
                    <em class="parameter"><code><a class="link" href="glib-Perl-compatible-regular-expressions.html#GMatchInfo" title="GMatchInfo"><span class="type">GMatchInfo</span></a> **match_info</code></em>,
                    <em class="parameter"><code><a class="link" href="glib-Error-Reporting.html#GError" title="struct GError"><span class="type">GError</span></a> **error</code></em>);</pre>
<p>Scans for a match in string for the pattern in <em class="parameter"><code>regex</code></em>
.
The <em class="parameter"><code>match_options</code></em>
 are combined with the match options specified
when the <em class="parameter"><code>regex</code></em>
 structure was created, letting you have more
flexibility in reusing <a class="link" href="glib-Perl-compatible-regular-expressions.html#GRegex" title="GRegex"><span class="type">GRegex</span></a> structures.</p>
<p>Setting <em class="parameter"><code>start_position</code></em>
 differs from just passing over a shortened
string and setting <a class="link" href="glib-Perl-compatible-regular-expressions.html#G-REGEX-MATCH-NOTBOL:CAPS"><span class="type">G_REGEX_MATCH_NOTBOL</span></a> in the case of a pattern
that begins with any kind of lookbehind assertion, such as "\b".</p>
<p>A <a class="link" href="glib-Perl-compatible-regular-expressions.html#GMatchInfo" title="GMatchInfo"><span class="type">GMatchInfo</span></a> structure, used to get information on the match, is
stored in <em class="parameter"><code>match_info</code></em>
 if not <a class="link" href="glib-Standard-Macros.html#NULL:CAPS" title="NULL"><code class="literal">NULL</code></a>. Note that if <em class="parameter"><code>match_info</code></em>
 is
not <a class="link" href="glib-Standard-Macros.html#NULL:CAPS" title="NULL"><code class="literal">NULL</code></a> then it is created even if the function returns <a class="link" href="glib-Standard-Macros.html#FALSE:CAPS" title="FALSE"><code class="literal">FALSE</code></a>,
i.e. you must free it regardless if regular expression actually
matched.</p>
<p><em class="parameter"><code>string</code></em>
 is not copied and is used in <a class="link" href="glib-Perl-compatible-regular-expressions.html#GMatchInfo" title="GMatchInfo"><span class="type">GMatchInfo</span></a> internally. If
you use any <a class="link" href="glib-Perl-compatible-regular-expressions.html#GMatchInfo" title="GMatchInfo"><span class="type">GMatchInfo</span></a> method (except <a class="link" href="glib-Perl-compatible-regular-expressions.html#g-match-info-free" title="g_match_info_free ()"><code class="function">g_match_info_free()</code></a>) after
freeing or modifying <em class="parameter"><code>string</code></em>
 then the behaviour is undefined.</p>
<p>To retrieve all the non-overlapping matches of the pattern in
string you can use <a class="link" href="glib-Perl-compatible-regular-expressions.html#g-match-info-next" title="g_match_info_next ()"><code class="function">g_match_info_next()</code></a>.</p>
<div class="informalexample">
  <table class="listing_frame" border="0" cellpadding="0" cellspacing="0">
    <tbody>
      <tr>
        <td class="listing_lines" align="right"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25</pre></td>
        <td class="listing_code"><pre class="programlisting"><span class="gtkdoc kwb">static void</span>
<span class="function">print_uppercase_words</span> <span class="gtkdoc opt">(</span><span class="gtkdoc kwb">const</span> gchar <span class="gtkdoc opt">*</span>string<span class="gtkdoc opt">)</span>
<span class="gtkdoc opt">{</span>
  <span class="gtkdoc slc">// Print all uppercase-only words.</span>
  GRegex <span class="gtkdoc opt">*</span>regex<span class="gtkdoc opt">;</span>
  GMatchInfo <span class="gtkdoc opt">*</span>match_info<span class="gtkdoc opt">;</span>
  GError <span class="gtkdoc opt">*</span>error <span class="gtkdoc opt">=</span> NULL<span class="gtkdoc opt">;</span>
  
  regex <span class="gtkdoc opt">=</span> <span class="function"><a href="glib-Perl-compatible-regular-expressions.html#g-regex-new">g_regex_new</a></span> <span class="gtkdoc opt">(</span><span class="string">&quot;[A-Z]+&quot;</span><span class="gtkdoc opt">,</span> <span class="number">0</span><span class="gtkdoc opt">,</span> <span class="number">0</span><span class="gtkdoc opt">,</span> NULL<span class="gtkdoc opt">);</span>
  <span class="function"><a href="glib-Perl-compatible-regular-expressions.html#g-regex-match-full">g_regex_match_full</a></span> <span class="gtkdoc opt">(</span>regex<span class="gtkdoc opt">,</span> string<span class="gtkdoc opt">, -</span><span class="number">1</span><span class="gtkdoc opt">,</span> <span class="number">0</span><span class="gtkdoc opt">,</span> <span class="number">0</span><span class="gtkdoc opt">, &amp;</span>match_info<span class="gtkdoc opt">, &amp;</span>error<span class="gtkdoc opt">);</span>
  <span class="keyword">while</span> <span class="gtkdoc opt">(</span><span class="function"><a href="glib-Perl-compatible-regular-expressions.html#g-match-info-matches">g_match_info_matches</a></span> <span class="gtkdoc opt">(</span>match_info<span class="gtkdoc opt">))</span>
    <span class="gtkdoc opt">{</span>
      gchar <span class="gtkdoc opt">*</span>word <span class="gtkdoc opt">=</span> <span class="function"><a href="glib-Perl-compatible-regular-expressions.html#g-match-info-fetch">g_match_info_fetch</a></span> <span class="gtkdoc opt">(</span>match_info<span class="gtkdoc opt">,</span> <span class="number">0</span><span class="gtkdoc opt">);</span>
      <span class="function"><a href="glib-Warnings-and-Assertions.html#g-print">g_print</a></span> <span class="gtkdoc opt">(</span><span class="string">&quot;Found: %s</span><span class="gtkdoc esc">\n</span><span class="string">&quot;</span><span class="gtkdoc opt">,</span> word<span class="gtkdoc opt">);</span>
      <span class="function"><a href="glib-Memory-Allocation.html#g-free">g_free</a></span> <span class="gtkdoc opt">(</span>word<span class="gtkdoc opt">);</span>
      <span class="function"><a href="glib-Perl-compatible-regular-expressions.html#g-match-info-next">g_match_info_next</a></span> <span class="gtkdoc opt">(</span>match_info<span class="gtkdoc opt">, &amp;</span>error<span class="gtkdoc opt">);</span>
    <span class="gtkdoc opt">}</span>
  <span class="function"><a href="glib-Perl-compatible-regular-expressions.html#g-match-info-free">g_match_info_free</a></span> <span class="gtkdoc opt">(</span>match_info<span class="gtkdoc opt">);</span>
  <span class="function"><a href="glib-Perl-compatible-regular-expressions.html#g-regex-unref">g_regex_unref</a></span> <span class="gtkdoc opt">(</span>regex<span class="gtkdoc opt">);</span>
  <span class="keyword">if</span> <span class="gtkdoc opt">(</span>error <span class="gtkdoc opt">!=</span> NULL<span class="gtkdoc opt">)</span>
    <span class="gtkdoc opt">{</span>
      <span class="function"><a href="glib-Warnings-and-Assertions.html#g-printerr">g_printerr</a></span> <span class="gtkdoc opt">(</span><span class="string">&quot;Error while matching: %s</span><span class="gtkdoc esc">\n</span><span class="string">&quot;</span><span class="gtkdoc opt">,</span> error<span class="gtkdoc opt">-&gt;</span>message<span class="gtkdoc opt">);</span>
      <span class="function"><a href="glib-Error-Reporting.html#g-error-free">g_error_free</a></span> <span class="gtkdoc opt">(</span>error<span class="gtkdoc opt">);</span>
    <span class="gtkdoc opt">}</span>
<span class="gtkdoc opt">}</span></pre></td>
      </tr>
    </tbody>
  </table>
</div>

<p></p>
<div class="refsect3">
<a name="g-regex-match-full.parameters"></a><h4>Parameters</h4>
<div class="informaltable"><table class="informaltable" width="100%" border="0">
<colgroup>
<col width="150px" class="parameters_name">
<col class="parameters_description">
<col width="200px" class="parameters_annotations">
</colgroup>
<tbody>
<tr>
<td class="parameter_name"><p>regex</p></td>
<td class="parameter_description"><p>a <a class="link" href="glib-Perl-compatible-regular-expressions.html#GRegex" title="GRegex"><span class="type">GRegex</span></a> structure from <a class="link" href="glib-Perl-compatible-regular-expressions.html#g-regex-new" title="g_regex_new ()"><code class="function">g_regex_new()</code></a></p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>string</p></td>
<td class="parameter_description"><p> the string to scan for matches. </p></td>
<td class="parameter_annotations"><span class="annotation">[<acronym title="Parameter points to an array of items."><span class="acronym">array</span></acronym> length=string_len]</span></td>
</tr>
<tr>
<td class="parameter_name"><p>string_len</p></td>
<td class="parameter_description"><p>the length of <em class="parameter"><code>string</code></em>
, or -1 if <em class="parameter"><code>string</code></em>
is nul-terminated</p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>start_position</p></td>
<td class="parameter_description"><p>starting index of the string to match, in bytes</p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>match_options</p></td>
<td class="parameter_description"><p>match options</p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>match_info</p></td>
<td class="parameter_description"><p> pointer to location where to store
the <a class="link" href="glib-Perl-compatible-regular-expressions.html#GMatchInfo" title="GMatchInfo"><span class="type">GMatchInfo</span></a>, or <a class="link" href="glib-Standard-Macros.html#NULL:CAPS" title="NULL"><code class="literal">NULL</code></a> if you do not need it. </p></td>
<td class="parameter_annotations"><span class="annotation">[<acronym title="Parameter for returning results. Default is transfer full."><span class="acronym">out</span></acronym>][<acronym title="NULL is OK, both for passing and for returning."><span class="acronym">allow-none</span></acronym>]</span></td>
</tr>
<tr>
<td class="parameter_name"><p>error</p></td>
<td class="parameter_description"><p>location to store the error occurring, or <a class="link" href="glib-Standard-Macros.html#NULL:CAPS" title="NULL"><code class="literal">NULL</code></a> to ignore errors</p></td>
<td class="parameter_annotations"> </td>
</tr>
</tbody>
</table></div>
</div>
<div class="refsect3">
<a name="g-regex-match-full.returns"></a><h4>Returns</h4>
<p> <a class="link" href="glib-Standard-Macros.html#TRUE:CAPS" title="TRUE"><code class="literal">TRUE</code></a> is the string matched, <a class="link" href="glib-Standard-Macros.html#FALSE:CAPS" title="FALSE"><code class="literal">FALSE</code></a> otherwise</p>
</div>
<p class="since">Since: <a class="link" href="api-index-2-14.html#api-index-2.14">2.14</a></p>
</div>
<hr>
<div class="refsect2">
<a name="g-regex-match-all"></a><h3>g_regex_match_all ()</h3>
<pre class="programlisting"><a class="link" href="glib-Basic-Types.html#gboolean" title="gboolean"><span class="returnvalue">gboolean</span></a>
g_regex_match_all (<em class="parameter"><code>const <a class="link" href="glib-Perl-compatible-regular-expressions.html#GRegex" title="GRegex"><span class="type">GRegex</span></a> *regex</code></em>,
                   <em class="parameter"><code>const <a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="type">gchar</span></a> *string</code></em>,
                   <em class="parameter"><code><a class="link" href="glib-Perl-compatible-regular-expressions.html#GRegexMatchFlags" title="enum GRegexMatchFlags"><span class="type">GRegexMatchFlags</span></a> match_options</code></em>,
                   <em class="parameter"><code><a class="link" href="glib-Perl-compatible-regular-expressions.html#GMatchInfo" title="GMatchInfo"><span class="type">GMatchInfo</span></a> **match_info</code></em>);</pre>
<p>Using the standard algorithm for regular expression matching only
the longest match in the string is retrieved. This function uses
a different algorithm so it can retrieve all the possible matches.
For more documentation see <a class="link" href="glib-Perl-compatible-regular-expressions.html#g-regex-match-all-full" title="g_regex_match_all_full ()"><code class="function">g_regex_match_all_full()</code></a>.</p>
<p>A <a class="link" href="glib-Perl-compatible-regular-expressions.html#GMatchInfo" title="GMatchInfo"><span class="type">GMatchInfo</span></a> structure, used to get information on the match, is
stored in <em class="parameter"><code>match_info</code></em>
 if not <a class="link" href="glib-Standard-Macros.html#NULL:CAPS" title="NULL"><code class="literal">NULL</code></a>. Note that if <em class="parameter"><code>match_info</code></em>
 is
not <a class="link" href="glib-Standard-Macros.html#NULL:CAPS" title="NULL"><code class="literal">NULL</code></a> then it is created even if the function returns <a class="link" href="glib-Standard-Macros.html#FALSE:CAPS" title="FALSE"><code class="literal">FALSE</code></a>,
i.e. you must free it regardless if regular expression actually
matched.</p>
<p><em class="parameter"><code>string</code></em>
 is not copied and is used in <a class="link" href="glib-Perl-compatible-regular-expressions.html#GMatchInfo" title="GMatchInfo"><span class="type">GMatchInfo</span></a> internally. If
you use any <a class="link" href="glib-Perl-compatible-regular-expressions.html#GMatchInfo" title="GMatchInfo"><span class="type">GMatchInfo</span></a> method (except <a class="link" href="glib-Perl-compatible-regular-expressions.html#g-match-info-free" title="g_match_info_free ()"><code class="function">g_match_info_free()</code></a>) after
freeing or modifying <em class="parameter"><code>string</code></em>
 then the behaviour is undefined.</p>
<div class="refsect3">
<a name="g-regex-match-all.parameters"></a><h4>Parameters</h4>
<div class="informaltable"><table class="informaltable" width="100%" border="0">
<colgroup>
<col width="150px" class="parameters_name">
<col class="parameters_description">
<col width="200px" class="parameters_annotations">
</colgroup>
<tbody>
<tr>
<td class="parameter_name"><p>regex</p></td>
<td class="parameter_description"><p>a <a class="link" href="glib-Perl-compatible-regular-expressions.html#GRegex" title="GRegex"><span class="type">GRegex</span></a> structure from <a class="link" href="glib-Perl-compatible-regular-expressions.html#g-regex-new" title="g_regex_new ()"><code class="function">g_regex_new()</code></a></p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>string</p></td>
<td class="parameter_description"><p>the string to scan for matches</p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>match_options</p></td>
<td class="parameter_description"><p>match options</p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>match_info</p></td>
<td class="parameter_description"><p> pointer to location where to store
the <a class="link" href="glib-Perl-compatible-regular-expressions.html#GMatchInfo" title="GMatchInfo"><span class="type">GMatchInfo</span></a>, or <a class="link" href="glib-Standard-Macros.html#NULL:CAPS" title="NULL"><code class="literal">NULL</code></a> if you do not need it. </p></td>
<td class="parameter_annotations"><span class="annotation">[<acronym title="Parameter for returning results. Default is transfer full."><span class="acronym">out</span></acronym>][<acronym title="NULL is OK, both for passing and for returning."><span class="acronym">allow-none</span></acronym>]</span></td>
</tr>
</tbody>
</table></div>
</div>
<div class="refsect3">
<a name="g-regex-match-all.returns"></a><h4>Returns</h4>
<p> <a class="link" href="glib-Standard-Macros.html#TRUE:CAPS" title="TRUE"><code class="literal">TRUE</code></a> is the string matched, <a class="link" href="glib-Standard-Macros.html#FALSE:CAPS" title="FALSE"><code class="literal">FALSE</code></a> otherwise</p>
</div>
<p class="since">Since: <a class="link" href="api-index-2-14.html#api-index-2.14">2.14</a></p>
</div>
<hr>
<div class="refsect2">
<a name="g-regex-match-all-full"></a><h3>g_regex_match_all_full ()</h3>
<pre class="programlisting"><a class="link" href="glib-Basic-Types.html#gboolean" title="gboolean"><span class="returnvalue">gboolean</span></a>
g_regex_match_all_full (<em class="parameter"><code>const <a class="link" href="glib-Perl-compatible-regular-expressions.html#GRegex" title="GRegex"><span class="type">GRegex</span></a> *regex</code></em>,
                        <em class="parameter"><code>const <a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="type">gchar</span></a> *string</code></em>,
                        <em class="parameter"><code><a class="link" href="glib-Basic-Types.html#gssize" title="gssize"><span class="type">gssize</span></a> string_len</code></em>,
                        <em class="parameter"><code><a class="link" href="glib-Basic-Types.html#gint" title="gint ()"><span class="type">gint</span></a> start_position</code></em>,
                        <em class="parameter"><code><a class="link" href="glib-Perl-compatible-regular-expressions.html#GRegexMatchFlags" title="enum GRegexMatchFlags"><span class="type">GRegexMatchFlags</span></a> match_options</code></em>,
                        <em class="parameter"><code><a class="link" href="glib-Perl-compatible-regular-expressions.html#GMatchInfo" title="GMatchInfo"><span class="type">GMatchInfo</span></a> **match_info</code></em>,
                        <em class="parameter"><code><a class="link" href="glib-Error-Reporting.html#GError" title="struct GError"><span class="type">GError</span></a> **error</code></em>);</pre>
<p>Using the standard algorithm for regular expression matching only
the longest match in the string is retrieved, it is not possible
to obtain all the available matches. For instance matching
"&lt;a&gt; &lt;b&gt; &lt;c&gt;" against the pattern "&lt;.*&gt;"
you get "&lt;a&gt; &lt;b&gt; &lt;c&gt;".</p>
<p>This function uses a different algorithm (called DFA, i.e. deterministic
finite automaton), so it can retrieve all the possible matches, all
starting at the same point in the string. For instance matching
"&lt;a&gt; &lt;b&gt; &lt;c&gt;" against the pattern "&lt;.*&gt;;"
you would obtain three matches: "&lt;a&gt; &lt;b&gt; &lt;c&gt;",
"&lt;a&gt; &lt;b&gt;" and "&lt;a&gt;".</p>
<p>The number of matched strings is retrieved using
<a class="link" href="glib-Perl-compatible-regular-expressions.html#g-match-info-get-match-count" title="g_match_info_get_match_count ()"><code class="function">g_match_info_get_match_count()</code></a>. To obtain the matched strings and
their position you can use, respectively, <a class="link" href="glib-Perl-compatible-regular-expressions.html#g-match-info-fetch" title="g_match_info_fetch ()"><code class="function">g_match_info_fetch()</code></a> and
<a class="link" href="glib-Perl-compatible-regular-expressions.html#g-match-info-fetch-pos" title="g_match_info_fetch_pos ()"><code class="function">g_match_info_fetch_pos()</code></a>. Note that the strings are returned in
reverse order of length; that is, the longest matching string is
given first.</p>
<p>Note that the DFA algorithm is slower than the standard one and it
is not able to capture substrings, so backreferences do not work.</p>
<p>Setting <em class="parameter"><code>start_position</code></em>
 differs from just passing over a shortened
string and setting <a class="link" href="glib-Perl-compatible-regular-expressions.html#G-REGEX-MATCH-NOTBOL:CAPS"><span class="type">G_REGEX_MATCH_NOTBOL</span></a> in the case of a pattern
that begins with any kind of lookbehind assertion, such as "\b".</p>
<p>A <a class="link" href="glib-Perl-compatible-regular-expressions.html#GMatchInfo" title="GMatchInfo"><span class="type">GMatchInfo</span></a> structure, used to get information on the match, is
stored in <em class="parameter"><code>match_info</code></em>
 if not <a class="link" href="glib-Standard-Macros.html#NULL:CAPS" title="NULL"><code class="literal">NULL</code></a>. Note that if <em class="parameter"><code>match_info</code></em>
 is
not <a class="link" href="glib-Standard-Macros.html#NULL:CAPS" title="NULL"><code class="literal">NULL</code></a> then it is created even if the function returns <a class="link" href="glib-Standard-Macros.html#FALSE:CAPS" title="FALSE"><code class="literal">FALSE</code></a>,
i.e. you must free it regardless if regular expression actually
matched.</p>
<p><em class="parameter"><code>string</code></em>
 is not copied and is used in <a class="link" href="glib-Perl-compatible-regular-expressions.html#GMatchInfo" title="GMatchInfo"><span class="type">GMatchInfo</span></a> internally. If
you use any <a class="link" href="glib-Perl-compatible-regular-expressions.html#GMatchInfo" title="GMatchInfo"><span class="type">GMatchInfo</span></a> method (except <a class="link" href="glib-Perl-compatible-regular-expressions.html#g-match-info-free" title="g_match_info_free ()"><code class="function">g_match_info_free()</code></a>) after
freeing or modifying <em class="parameter"><code>string</code></em>
 then the behaviour is undefined.</p>
<div class="refsect3">
<a name="g-regex-match-all-full.parameters"></a><h4>Parameters</h4>
<div class="informaltable"><table class="informaltable" width="100%" border="0">
<colgroup>
<col width="150px" class="parameters_name">
<col class="parameters_description">
<col width="200px" class="parameters_annotations">
</colgroup>
<tbody>
<tr>
<td class="parameter_name"><p>regex</p></td>
<td class="parameter_description"><p>a <a class="link" href="glib-Perl-compatible-regular-expressions.html#GRegex" title="GRegex"><span class="type">GRegex</span></a> structure from <a class="link" href="glib-Perl-compatible-regular-expressions.html#g-regex-new" title="g_regex_new ()"><code class="function">g_regex_new()</code></a></p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>string</p></td>
<td class="parameter_description"><p> the string to scan for matches. </p></td>
<td class="parameter_annotations"><span class="annotation">[<acronym title="Parameter points to an array of items."><span class="acronym">array</span></acronym> length=string_len]</span></td>
</tr>
<tr>
<td class="parameter_name"><p>string_len</p></td>
<td class="parameter_description"><p>the length of <em class="parameter"><code>string</code></em>
, or -1 if <em class="parameter"><code>string</code></em>
is nul-terminated</p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>start_position</p></td>
<td class="parameter_description"><p>starting index of the string to match, in bytes</p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>match_options</p></td>
<td class="parameter_description"><p>match options</p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>match_info</p></td>
<td class="parameter_description"><p> pointer to location where to store
the <a class="link" href="glib-Perl-compatible-regular-expressions.html#GMatchInfo" title="GMatchInfo"><span class="type">GMatchInfo</span></a>, or <a class="link" href="glib-Standard-Macros.html#NULL:CAPS" title="NULL"><code class="literal">NULL</code></a> if you do not need it. </p></td>
<td class="parameter_annotations"><span class="annotation">[<acronym title="Parameter for returning results. Default is transfer full."><span class="acronym">out</span></acronym>][<acronym title="NULL is OK, both for passing and for returning."><span class="acronym">allow-none</span></acronym>]</span></td>
</tr>
<tr>
<td class="parameter_name"><p>error</p></td>
<td class="parameter_description"><p>location to store the error occurring, or <a class="link" href="glib-Standard-Macros.html#NULL:CAPS" title="NULL"><code class="literal">NULL</code></a> to ignore errors</p></td>
<td class="parameter_annotations"> </td>
</tr>
</tbody>
</table></div>
</div>
<div class="refsect3">
<a name="g-regex-match-all-full.returns"></a><h4>Returns</h4>
<p> <a class="link" href="glib-Standard-Macros.html#TRUE:CAPS" title="TRUE"><code class="literal">TRUE</code></a> is the string matched, <a class="link" href="glib-Standard-Macros.html#FALSE:CAPS" title="FALSE"><code class="literal">FALSE</code></a> otherwise</p>
</div>
<p class="since">Since: <a class="link" href="api-index-2-14.html#api-index-2.14">2.14</a></p>
</div>
<hr>
<div class="refsect2">
<a name="g-regex-split-simple"></a><h3>g_regex_split_simple ()</h3>
<pre class="programlisting"><a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="returnvalue">gchar</span></a> **
g_regex_split_simple (<em class="parameter"><code>const <a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="type">gchar</span></a> *pattern</code></em>,
                      <em class="parameter"><code>const <a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="type">gchar</span></a> *string</code></em>,
                      <em class="parameter"><code><a class="link" href="glib-Perl-compatible-regular-expressions.html#GRegexCompileFlags" title="enum GRegexCompileFlags"><span class="type">GRegexCompileFlags</span></a> compile_options</code></em>,
                      <em class="parameter"><code><a class="link" href="glib-Perl-compatible-regular-expressions.html#GRegexMatchFlags" title="enum GRegexMatchFlags"><span class="type">GRegexMatchFlags</span></a> match_options</code></em>);</pre>
<p>Breaks the string on the pattern, and returns an array of
the tokens. If the pattern contains capturing parentheses,
then the text for each of the substrings will also be returned.
If the pattern does not match anywhere in the string, then the
whole string is returned as the first token.</p>
<p>This function is equivalent to <a class="link" href="glib-Perl-compatible-regular-expressions.html#g-regex-split" title="g_regex_split ()"><code class="function">g_regex_split()</code></a> but it does
not require to compile the pattern with <a class="link" href="glib-Perl-compatible-regular-expressions.html#g-regex-new" title="g_regex_new ()"><code class="function">g_regex_new()</code></a>, avoiding
some lines of code when you need just to do a split without
extracting substrings, capture counts, and so on.</p>
<p>If this function is to be called on the same <em class="parameter"><code>pattern</code></em>
 more than
once, it's more efficient to compile the pattern once with
<a class="link" href="glib-Perl-compatible-regular-expressions.html#g-regex-new" title="g_regex_new ()"><code class="function">g_regex_new()</code></a> and then use <a class="link" href="glib-Perl-compatible-regular-expressions.html#g-regex-split" title="g_regex_split ()"><code class="function">g_regex_split()</code></a>.</p>
<p>As a special case, the result of splitting the empty string ""
is an empty vector, not a vector containing a single string.
The reason for this special case is that being able to represent
a empty vector is typically more useful than consistent handling
of empty elements. If you do need to represent empty elements,
you'll need to check for the empty string before calling this
function.</p>
<p>A pattern that can match empty strings splits <em class="parameter"><code>string</code></em>
 into
separate characters wherever it matches the empty string between
characters. For example splitting "ab c" using as a separator
"\s*", you will get "a", "b" and "c".</p>
<div class="refsect3">
<a name="g-regex-split-simple.parameters"></a><h4>Parameters</h4>
<div class="informaltable"><table class="informaltable" width="100%" border="0">
<colgroup>
<col width="150px" class="parameters_name">
<col class="parameters_description">
<col width="200px" class="parameters_annotations">
</colgroup>
<tbody>
<tr>
<td class="parameter_name"><p>pattern</p></td>
<td class="parameter_description"><p>the regular expression</p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>string</p></td>
<td class="parameter_description"><p>the string to scan for matches</p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>compile_options</p></td>
<td class="parameter_description"><p>compile options for the regular expression, or 0</p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>match_options</p></td>
<td class="parameter_description"><p>match options, or 0</p></td>
<td class="parameter_annotations"> </td>
</tr>
</tbody>
</table></div>
</div>
<div class="refsect3">
<a name="g-regex-split-simple.returns"></a><h4>Returns</h4>
<p> a <a class="link" href="glib-Standard-Macros.html#NULL:CAPS" title="NULL"><code class="literal">NULL</code></a>-terminated array of strings. Free
it using <a class="link" href="glib-String-Utility-Functions.html#g-strfreev" title="g_strfreev ()"><code class="function">g_strfreev()</code></a>. </p>
<p><span class="annotation">[<acronym title="Free data after the code is done."><span class="acronym">transfer full</span></acronym>]</span></p>
</div>
<p class="since">Since: <a class="link" href="api-index-2-14.html#api-index-2.14">2.14</a></p>
</div>
<hr>
<div class="refsect2">
<a name="g-regex-split"></a><h3>g_regex_split ()</h3>
<pre class="programlisting"><a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="returnvalue">gchar</span></a> **
g_regex_split (<em class="parameter"><code>const <a class="link" href="glib-Perl-compatible-regular-expressions.html#GRegex" title="GRegex"><span class="type">GRegex</span></a> *regex</code></em>,
               <em class="parameter"><code>const <a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="type">gchar</span></a> *string</code></em>,
               <em class="parameter"><code><a class="link" href="glib-Perl-compatible-regular-expressions.html#GRegexMatchFlags" title="enum GRegexMatchFlags"><span class="type">GRegexMatchFlags</span></a> match_options</code></em>);</pre>
<p>Breaks the string on the pattern, and returns an array of the tokens.
If the pattern contains capturing parentheses, then the text for each
of the substrings will also be returned. If the pattern does not match
anywhere in the string, then the whole string is returned as the first
token.</p>
<p>As a special case, the result of splitting the empty string "" is an
empty vector, not a vector containing a single string. The reason for
this special case is that being able to represent a empty vector is
typically more useful than consistent handling of empty elements. If
you do need to represent empty elements, you'll need to check for the
empty string before calling this function.</p>
<p>A pattern that can match empty strings splits <em class="parameter"><code>string</code></em>
 into separate
characters wherever it matches the empty string between characters.
For example splitting "ab c" using as a separator "\s*", you will get
"a", "b" and "c".</p>
<div class="refsect3">
<a name="g-regex-split.parameters"></a><h4>Parameters</h4>
<div class="informaltable"><table class="informaltable" width="100%" border="0">
<colgroup>
<col width="150px" class="parameters_name">
<col class="parameters_description">
<col width="200px" class="parameters_annotations">
</colgroup>
<tbody>
<tr>
<td class="parameter_name"><p>regex</p></td>
<td class="parameter_description"><p>a <a class="link" href="glib-Perl-compatible-regular-expressions.html#GRegex" title="GRegex"><span class="type">GRegex</span></a> structure</p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>string</p></td>
<td class="parameter_description"><p>the string to split with the pattern</p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>match_options</p></td>
<td class="parameter_description"><p>match time option flags</p></td>
<td class="parameter_annotations"> </td>
</tr>
</tbody>
</table></div>
</div>
<div class="refsect3">
<a name="g-regex-split.returns"></a><h4>Returns</h4>
<p> a <a class="link" href="glib-Standard-Macros.html#NULL:CAPS" title="NULL"><code class="literal">NULL</code></a>-terminated gchar ** array. Free
it using <a class="link" href="glib-String-Utility-Functions.html#g-strfreev" title="g_strfreev ()"><code class="function">g_strfreev()</code></a>. </p>
<p><span class="annotation">[<acronym title="Free data after the code is done."><span class="acronym">transfer full</span></acronym>]</span></p>
</div>
<p class="since">Since: <a class="link" href="api-index-2-14.html#api-index-2.14">2.14</a></p>
</div>
<hr>
<div class="refsect2">
<a name="g-regex-split-full"></a><h3>g_regex_split_full ()</h3>
<pre class="programlisting"><a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="returnvalue">gchar</span></a> **
g_regex_split_full (<em class="parameter"><code>const <a class="link" href="glib-Perl-compatible-regular-expressions.html#GRegex" title="GRegex"><span class="type">GRegex</span></a> *regex</code></em>,
                    <em class="parameter"><code>const <a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="type">gchar</span></a> *string</code></em>,
                    <em class="parameter"><code><a class="link" href="glib-Basic-Types.html#gssize" title="gssize"><span class="type">gssize</span></a> string_len</code></em>,
                    <em class="parameter"><code><a class="link" href="glib-Basic-Types.html#gint" title="gint ()"><span class="type">gint</span></a> start_position</code></em>,
                    <em class="parameter"><code><a class="link" href="glib-Perl-compatible-regular-expressions.html#GRegexMatchFlags" title="enum GRegexMatchFlags"><span class="type">GRegexMatchFlags</span></a> match_options</code></em>,
                    <em class="parameter"><code><a class="link" href="glib-Basic-Types.html#gint" title="gint ()"><span class="type">gint</span></a> max_tokens</code></em>,
                    <em class="parameter"><code><a class="link" href="glib-Error-Reporting.html#GError" title="struct GError"><span class="type">GError</span></a> **error</code></em>);</pre>
<p>Breaks the string on the pattern, and returns an array of the tokens.
If the pattern contains capturing parentheses, then the text for each
of the substrings will also be returned. If the pattern does not match
anywhere in the string, then the whole string is returned as the first
token.</p>
<p>As a special case, the result of splitting the empty string "" is an
empty vector, not a vector containing a single string. The reason for
this special case is that being able to represent a empty vector is
typically more useful than consistent handling of empty elements. If
you do need to represent empty elements, you'll need to check for the
empty string before calling this function.</p>
<p>A pattern that can match empty strings splits <em class="parameter"><code>string</code></em>
 into separate
characters wherever it matches the empty string between characters.
For example splitting "ab c" using as a separator "\s*", you will get
"a", "b" and "c".</p>
<p>Setting <em class="parameter"><code>start_position</code></em>
 differs from just passing over a shortened
string and setting <a class="link" href="glib-Perl-compatible-regular-expressions.html#G-REGEX-MATCH-NOTBOL:CAPS"><span class="type">G_REGEX_MATCH_NOTBOL</span></a> in the case of a pattern
that begins with any kind of lookbehind assertion, such as "\b".</p>
<div class="refsect3">
<a name="g-regex-split-full.parameters"></a><h4>Parameters</h4>
<div class="informaltable"><table class="informaltable" width="100%" border="0">
<colgroup>
<col width="150px" class="parameters_name">
<col class="parameters_description">
<col width="200px" class="parameters_annotations">
</colgroup>
<tbody>
<tr>
<td class="parameter_name"><p>regex</p></td>
<td class="parameter_description"><p>a <a class="link" href="glib-Perl-compatible-regular-expressions.html#GRegex" title="GRegex"><span class="type">GRegex</span></a> structure</p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>string</p></td>
<td class="parameter_description"><p> the string to split with the pattern. </p></td>
<td class="parameter_annotations"><span class="annotation">[<acronym title="Parameter points to an array of items."><span class="acronym">array</span></acronym> length=string_len]</span></td>
</tr>
<tr>
<td class="parameter_name"><p>string_len</p></td>
<td class="parameter_description"><p>the length of <em class="parameter"><code>string</code></em>
, or -1 if <em class="parameter"><code>string</code></em>
is nul-terminated</p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>start_position</p></td>
<td class="parameter_description"><p>starting index of the string to match, in bytes</p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>match_options</p></td>
<td class="parameter_description"><p>match time option flags</p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>max_tokens</p></td>
<td class="parameter_description"><p>the maximum number of tokens to split <em class="parameter"><code>string</code></em>
into.
If this is less than 1, the string is split completely</p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>error</p></td>
<td class="parameter_description"><p>return location for a <a class="link" href="glib-Error-Reporting.html#GError" title="struct GError"><span class="type">GError</span></a></p></td>
<td class="parameter_annotations"> </td>
</tr>
</tbody>
</table></div>
</div>
<div class="refsect3">
<a name="g-regex-split-full.returns"></a><h4>Returns</h4>
<p> a <a class="link" href="glib-Standard-Macros.html#NULL:CAPS" title="NULL"><code class="literal">NULL</code></a>-terminated gchar ** array. Free
it using <a class="link" href="glib-String-Utility-Functions.html#g-strfreev" title="g_strfreev ()"><code class="function">g_strfreev()</code></a>. </p>
<p><span class="annotation">[<acronym title="Free data after the code is done."><span class="acronym">transfer full</span></acronym>]</span></p>
</div>
<p class="since">Since: <a class="link" href="api-index-2-14.html#api-index-2.14">2.14</a></p>
</div>
<hr>
<div class="refsect2">
<a name="g-regex-replace"></a><h3>g_regex_replace ()</h3>
<pre class="programlisting"><a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="returnvalue">gchar</span></a> *
g_regex_replace (<em class="parameter"><code>const <a class="link" href="glib-Perl-compatible-regular-expressions.html#GRegex" title="GRegex"><span class="type">GRegex</span></a> *regex</code></em>,
                 <em class="parameter"><code>const <a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="type">gchar</span></a> *string</code></em>,
                 <em class="parameter"><code><a class="link" href="glib-Basic-Types.html#gssize" title="gssize"><span class="type">gssize</span></a> string_len</code></em>,
                 <em class="parameter"><code><a class="link" href="glib-Basic-Types.html#gint" title="gint ()"><span class="type">gint</span></a> start_position</code></em>,
                 <em class="parameter"><code>const <a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="type">gchar</span></a> *replacement</code></em>,
                 <em class="parameter"><code><a class="link" href="glib-Perl-compatible-regular-expressions.html#GRegexMatchFlags" title="enum GRegexMatchFlags"><span class="type">GRegexMatchFlags</span></a> match_options</code></em>,
                 <em class="parameter"><code><a class="link" href="glib-Error-Reporting.html#GError" title="struct GError"><span class="type">GError</span></a> **error</code></em>);</pre>
<p>Replaces all occurrences of the pattern in <em class="parameter"><code>regex</code></em>
 with the
replacement text. Backreferences of the form '\number' or
'\g&lt;number&gt;' in the replacement text are interpolated by the
number-th captured subexpression of the match, '\g&lt;name&gt;' refers
to the captured subexpression with the given name. '\0' refers
to the complete match, but '\0' followed by a number is the octal
representation of a character. To include a literal '\' in the
replacement, write '\'.</p>
<p>There are also escapes that changes the case of the following text:</p>
<div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem"><p>\l: Convert to lower case the next character</p></li>
<li class="listitem"><p>\u: Convert to upper case the next character</p></li>
<li class="listitem"><p>\L: Convert to lower case till \E</p></li>
<li class="listitem"><p>\U: Convert to upper case till \E</p></li>
<li class="listitem"><p>\E: End case modification</p></li>
</ul></div>
<p>If you do not need to use backreferences use <a class="link" href="glib-Perl-compatible-regular-expressions.html#g-regex-replace-literal" title="g_regex_replace_literal ()"><code class="function">g_regex_replace_literal()</code></a>.</p>
<p>The <em class="parameter"><code>replacement</code></em>
 string must be UTF-8 encoded even if <a class="link" href="glib-Perl-compatible-regular-expressions.html#G-REGEX-RAW:CAPS"><span class="type">G_REGEX_RAW</span></a> was
passed to <a class="link" href="glib-Perl-compatible-regular-expressions.html#g-regex-new" title="g_regex_new ()"><code class="function">g_regex_new()</code></a>. If you want to use not UTF-8 encoded stings
you can use <a class="link" href="glib-Perl-compatible-regular-expressions.html#g-regex-replace-literal" title="g_regex_replace_literal ()"><code class="function">g_regex_replace_literal()</code></a>.</p>
<p>Setting <em class="parameter"><code>start_position</code></em>
 differs from just passing over a shortened
string and setting <a class="link" href="glib-Perl-compatible-regular-expressions.html#G-REGEX-MATCH-NOTBOL:CAPS"><span class="type">G_REGEX_MATCH_NOTBOL</span></a> in the case of a pattern that
begins with any kind of lookbehind assertion, such as "\b".</p>
<div class="refsect3">
<a name="g-regex-replace.parameters"></a><h4>Parameters</h4>
<div class="informaltable"><table class="informaltable" width="100%" border="0">
<colgroup>
<col width="150px" class="parameters_name">
<col class="parameters_description">
<col width="200px" class="parameters_annotations">
</colgroup>
<tbody>
<tr>
<td class="parameter_name"><p>regex</p></td>
<td class="parameter_description"><p>a <a class="link" href="glib-Perl-compatible-regular-expressions.html#GRegex" title="GRegex"><span class="type">GRegex</span></a> structure</p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>string</p></td>
<td class="parameter_description"><p> the string to perform matches against. </p></td>
<td class="parameter_annotations"><span class="annotation">[<acronym title="Parameter points to an array of items."><span class="acronym">array</span></acronym> length=string_len]</span></td>
</tr>
<tr>
<td class="parameter_name"><p>string_len</p></td>
<td class="parameter_description"><p>the length of <em class="parameter"><code>string</code></em>
, or -1 if <em class="parameter"><code>string</code></em>
is nul-terminated</p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>start_position</p></td>
<td class="parameter_description"><p>starting index of the string to match, in bytes</p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>replacement</p></td>
<td class="parameter_description"><p>text to replace each match with</p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>match_options</p></td>
<td class="parameter_description"><p>options for the match</p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>error</p></td>
<td class="parameter_description"><p>location to store the error occurring, or <a class="link" href="glib-Standard-Macros.html#NULL:CAPS" title="NULL"><code class="literal">NULL</code></a> to ignore errors</p></td>
<td class="parameter_annotations"> </td>
</tr>
</tbody>
</table></div>
</div>
<div class="refsect3">
<a name="g-regex-replace.returns"></a><h4>Returns</h4>
<p> a newly allocated string containing the replacements</p>
</div>
<p class="since">Since: <a class="link" href="api-index-2-14.html#api-index-2.14">2.14</a></p>
</div>
<hr>
<div class="refsect2">
<a name="g-regex-replace-literal"></a><h3>g_regex_replace_literal ()</h3>
<pre class="programlisting"><a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="returnvalue">gchar</span></a> *
g_regex_replace_literal (<em class="parameter"><code>const <a class="link" href="glib-Perl-compatible-regular-expressions.html#GRegex" title="GRegex"><span class="type">GRegex</span></a> *regex</code></em>,
                         <em class="parameter"><code>const <a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="type">gchar</span></a> *string</code></em>,
                         <em class="parameter"><code><a class="link" href="glib-Basic-Types.html#gssize" title="gssize"><span class="type">gssize</span></a> string_len</code></em>,
                         <em class="parameter"><code><a class="link" href="glib-Basic-Types.html#gint" title="gint ()"><span class="type">gint</span></a> start_position</code></em>,
                         <em class="parameter"><code>const <a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="type">gchar</span></a> *replacement</code></em>,
                         <em class="parameter"><code><a class="link" href="glib-Perl-compatible-regular-expressions.html#GRegexMatchFlags" title="enum GRegexMatchFlags"><span class="type">GRegexMatchFlags</span></a> match_options</code></em>,
                         <em class="parameter"><code><a class="link" href="glib-Error-Reporting.html#GError" title="struct GError"><span class="type">GError</span></a> **error</code></em>);</pre>
<p>Replaces all occurrences of the pattern in <em class="parameter"><code>regex</code></em>
 with the
replacement text. <em class="parameter"><code>replacement</code></em>
 is replaced literally, to
include backreferences use <a class="link" href="glib-Perl-compatible-regular-expressions.html#g-regex-replace" title="g_regex_replace ()"><code class="function">g_regex_replace()</code></a>.</p>
<p>Setting <em class="parameter"><code>start_position</code></em>
 differs from just passing over a
shortened string and setting <a class="link" href="glib-Perl-compatible-regular-expressions.html#G-REGEX-MATCH-NOTBOL:CAPS"><span class="type">G_REGEX_MATCH_NOTBOL</span></a> in the
case of a pattern that begins with any kind of lookbehind
assertion, such as "\b".</p>
<div class="refsect3">
<a name="g-regex-replace-literal.parameters"></a><h4>Parameters</h4>
<div class="informaltable"><table class="informaltable" width="100%" border="0">
<colgroup>
<col width="150px" class="parameters_name">
<col class="parameters_description">
<col width="200px" class="parameters_annotations">
</colgroup>
<tbody>
<tr>
<td class="parameter_name"><p>regex</p></td>
<td class="parameter_description"><p>a <a class="link" href="glib-Perl-compatible-regular-expressions.html#GRegex" title="GRegex"><span class="type">GRegex</span></a> structure</p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>string</p></td>
<td class="parameter_description"><p> the string to perform matches against. </p></td>
<td class="parameter_annotations"><span class="annotation">[<acronym title="Parameter points to an array of items."><span class="acronym">array</span></acronym> length=string_len]</span></td>
</tr>
<tr>
<td class="parameter_name"><p>string_len</p></td>
<td class="parameter_description"><p>the length of <em class="parameter"><code>string</code></em>
, or -1 if <em class="parameter"><code>string</code></em>
is nul-terminated</p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>start_position</p></td>
<td class="parameter_description"><p>starting index of the string to match, in bytes</p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>replacement</p></td>
<td class="parameter_description"><p>text to replace each match with</p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>match_options</p></td>
<td class="parameter_description"><p>options for the match</p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>error</p></td>
<td class="parameter_description"><p>location to store the error occurring, or <a class="link" href="glib-Standard-Macros.html#NULL:CAPS" title="NULL"><code class="literal">NULL</code></a> to ignore errors</p></td>
<td class="parameter_annotations"> </td>
</tr>
</tbody>
</table></div>
</div>
<div class="refsect3">
<a name="g-regex-replace-literal.returns"></a><h4>Returns</h4>
<p> a newly allocated string containing the replacements</p>
</div>
<p class="since">Since: <a class="link" href="api-index-2-14.html#api-index-2.14">2.14</a></p>
</div>
<hr>
<div class="refsect2">
<a name="g-regex-replace-eval"></a><h3>g_regex_replace_eval ()</h3>
<pre class="programlisting"><a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="returnvalue">gchar</span></a> *
g_regex_replace_eval (<em class="parameter"><code>const <a class="link" href="glib-Perl-compatible-regular-expressions.html#GRegex" title="GRegex"><span class="type">GRegex</span></a> *regex</code></em>,
                      <em class="parameter"><code>const <a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="type">gchar</span></a> *string</code></em>,
                      <em class="parameter"><code><a class="link" href="glib-Basic-Types.html#gssize" title="gssize"><span class="type">gssize</span></a> string_len</code></em>,
                      <em class="parameter"><code><a class="link" href="glib-Basic-Types.html#gint" title="gint ()"><span class="type">gint</span></a> start_position</code></em>,
                      <em class="parameter"><code><a class="link" href="glib-Perl-compatible-regular-expressions.html#GRegexMatchFlags" title="enum GRegexMatchFlags"><span class="type">GRegexMatchFlags</span></a> match_options</code></em>,
                      <em class="parameter"><code><a class="link" href="glib-Perl-compatible-regular-expressions.html#GRegexEvalCallback" title="GRegexEvalCallback ()"><span class="type">GRegexEvalCallback</span></a> eval</code></em>,
                      <em class="parameter"><code><a class="link" href="glib-Basic-Types.html#gpointer" title="gpointer"><span class="type">gpointer</span></a> user_data</code></em>,
                      <em class="parameter"><code><a class="link" href="glib-Error-Reporting.html#GError" title="struct GError"><span class="type">GError</span></a> **error</code></em>);</pre>
<p>Replaces occurrences of the pattern in regex with the output of
<em class="parameter"><code>eval</code></em>
 for that occurrence.</p>
<p>Setting <em class="parameter"><code>start_position</code></em>
 differs from just passing over a shortened
string and setting <a class="link" href="glib-Perl-compatible-regular-expressions.html#G-REGEX-MATCH-NOTBOL:CAPS"><span class="type">G_REGEX_MATCH_NOTBOL</span></a> in the case of a pattern
that begins with any kind of lookbehind assertion, such as "\b".</p>
<p>The following example uses <a class="link" href="glib-Perl-compatible-regular-expressions.html#g-regex-replace-eval" title="g_regex_replace_eval ()"><code class="function">g_regex_replace_eval()</code></a> to replace multiple
strings at once:</p>
<div class="informalexample">
  <table class="listing_frame" border="0" cellpadding="0" cellspacing="0">
    <tbody>
      <tr>
        <td class="listing_lines" align="right"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34</pre></td>
        <td class="listing_code"><pre class="programlisting"><span class="gtkdoc kwb">static</span> gboolean
<span class="function">eval_cb</span> <span class="gtkdoc opt">(</span><span class="gtkdoc kwb">const</span> GMatchInfo <span class="gtkdoc opt">*</span>info<span class="gtkdoc opt">,</span>
         GString          <span class="gtkdoc opt">*</span>res<span class="gtkdoc opt">,</span>
         gpointer          data<span class="gtkdoc opt">)</span>
<span class="gtkdoc opt">{</span>
  gchar <span class="gtkdoc opt">*</span>match<span class="gtkdoc opt">;</span>
  gchar <span class="gtkdoc opt">*</span>r<span class="gtkdoc opt">;</span>

   match <span class="gtkdoc opt">=</span> <span class="function"><a href="glib-Perl-compatible-regular-expressions.html#g-match-info-fetch">g_match_info_fetch</a></span> <span class="gtkdoc opt">(</span>info<span class="gtkdoc opt">,</span> <span class="number">0</span><span class="gtkdoc opt">);</span>
   r <span class="gtkdoc opt">=</span> <span class="function"><a href="glib-Hash-Tables.html#g-hash-table-lookup">g_hash_table_lookup</a></span> <span class="gtkdoc opt">((</span>GHashTable <span class="gtkdoc opt">*)</span>data<span class="gtkdoc opt">,</span> match<span class="gtkdoc opt">);</span>
   <span class="function"><a href="glib-Strings.html#g-string-append">g_string_append</a></span> <span class="gtkdoc opt">(</span>res<span class="gtkdoc opt">,</span> r<span class="gtkdoc opt">);</span>
   <span class="function"><a href="glib-Memory-Allocation.html#g-free">g_free</a></span> <span class="gtkdoc opt">(</span>match<span class="gtkdoc opt">);</span>

   <span class="keyword">return</span> FALSE<span class="gtkdoc opt">;</span>
<span class="gtkdoc opt">}</span>

<span class="gtkdoc opt">...</span>

GRegex <span class="gtkdoc opt">*</span>reg<span class="gtkdoc opt">;</span>
GHashTable <span class="gtkdoc opt">*</span>h<span class="gtkdoc opt">;</span>
gchar <span class="gtkdoc opt">*</span>res<span class="gtkdoc opt">;</span>

h <span class="gtkdoc opt">=</span> <span class="function"><a href="glib-Hash-Tables.html#g-hash-table-new">g_hash_table_new</a></span> <span class="gtkdoc opt">(</span>g_str_hash<span class="gtkdoc opt">,</span> g_str_equal<span class="gtkdoc opt">);</span>

<span class="function"><a href="glib-Hash-Tables.html#g-hash-table-insert">g_hash_table_insert</a></span> <span class="gtkdoc opt">(</span>h<span class="gtkdoc opt">,</span> <span class="string">&quot;1&quot;</span><span class="gtkdoc opt">,</span> <span class="string">&quot;ONE&quot;</span><span class="gtkdoc opt">);</span>
<span class="function"><a href="glib-Hash-Tables.html#g-hash-table-insert">g_hash_table_insert</a></span> <span class="gtkdoc opt">(</span>h<span class="gtkdoc opt">,</span> <span class="string">&quot;2&quot;</span><span class="gtkdoc opt">,</span> <span class="string">&quot;TWO&quot;</span><span class="gtkdoc opt">);</span>
<span class="function"><a href="glib-Hash-Tables.html#g-hash-table-insert">g_hash_table_insert</a></span> <span class="gtkdoc opt">(</span>h<span class="gtkdoc opt">,</span> <span class="string">&quot;3&quot;</span><span class="gtkdoc opt">,</span> <span class="string">&quot;THREE&quot;</span><span class="gtkdoc opt">);</span>
<span class="function"><a href="glib-Hash-Tables.html#g-hash-table-insert">g_hash_table_insert</a></span> <span class="gtkdoc opt">(</span>h<span class="gtkdoc opt">,</span> <span class="string">&quot;4&quot;</span><span class="gtkdoc opt">,</span> <span class="string">&quot;FOUR&quot;</span><span class="gtkdoc opt">);</span>

reg <span class="gtkdoc opt">=</span> <span class="function"><a href="glib-Perl-compatible-regular-expressions.html#g-regex-new">g_regex_new</a></span> <span class="gtkdoc opt">(</span><span class="string">&quot;1|2|3|4&quot;</span><span class="gtkdoc opt">,</span> <span class="number">0</span><span class="gtkdoc opt">,</span> <span class="number">0</span><span class="gtkdoc opt">,</span> NULL<span class="gtkdoc opt">);</span>
res <span class="gtkdoc opt">=</span> <span class="function"><a href="glib-Perl-compatible-regular-expressions.html#g-regex-replace-eval">g_regex_replace_eval</a></span> <span class="gtkdoc opt">(</span>reg<span class="gtkdoc opt">,</span> text<span class="gtkdoc opt">, -</span><span class="number">1</span><span class="gtkdoc opt">,</span> <span class="number">0</span><span class="gtkdoc opt">,</span> <span class="number">0</span><span class="gtkdoc opt">,</span> eval_cb<span class="gtkdoc opt">,</span> h<span class="gtkdoc opt">,</span> NULL<span class="gtkdoc opt">);</span>
<span class="function"><a href="glib-Hash-Tables.html#g-hash-table-destroy">g_hash_table_destroy</a></span> <span class="gtkdoc opt">(</span>h<span class="gtkdoc opt">);</span>

<span class="gtkdoc opt">...</span></pre></td>
      </tr>
    </tbody>
  </table>
</div>

<p></p>
<div class="refsect3">
<a name="g-regex-replace-eval.parameters"></a><h4>Parameters</h4>
<div class="informaltable"><table class="informaltable" width="100%" border="0">
<colgroup>
<col width="150px" class="parameters_name">
<col class="parameters_description">
<col width="200px" class="parameters_annotations">
</colgroup>
<tbody>
<tr>
<td class="parameter_name"><p>regex</p></td>
<td class="parameter_description"><p>a <a class="link" href="glib-Perl-compatible-regular-expressions.html#GRegex" title="GRegex"><span class="type">GRegex</span></a> structure from <a class="link" href="glib-Perl-compatible-regular-expressions.html#g-regex-new" title="g_regex_new ()"><code class="function">g_regex_new()</code></a></p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>string</p></td>
<td class="parameter_description"><p> string to perform matches against. </p></td>
<td class="parameter_annotations"><span class="annotation">[<acronym title="Parameter points to an array of items."><span class="acronym">array</span></acronym> length=string_len]</span></td>
</tr>
<tr>
<td class="parameter_name"><p>string_len</p></td>
<td class="parameter_description"><p>the length of <em class="parameter"><code>string</code></em>
, or -1 if <em class="parameter"><code>string</code></em>
is nul-terminated</p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>start_position</p></td>
<td class="parameter_description"><p>starting index of the string to match, in bytes</p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>match_options</p></td>
<td class="parameter_description"><p>options for the match</p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>eval</p></td>
<td class="parameter_description"><p>a function to call for each match</p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>user_data</p></td>
<td class="parameter_description"><p>user data to pass to the function</p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>error</p></td>
<td class="parameter_description"><p>location to store the error occurring, or <a class="link" href="glib-Standard-Macros.html#NULL:CAPS" title="NULL"><code class="literal">NULL</code></a> to ignore errors</p></td>
<td class="parameter_annotations"> </td>
</tr>
</tbody>
</table></div>
</div>
<div class="refsect3">
<a name="g-regex-replace-eval.returns"></a><h4>Returns</h4>
<p> a newly allocated string containing the replacements</p>
</div>
<p class="since">Since: <a class="link" href="api-index-2-14.html#api-index-2.14">2.14</a></p>
</div>
<hr>
<div class="refsect2">
<a name="g-regex-check-replacement"></a><h3>g_regex_check_replacement ()</h3>
<pre class="programlisting"><a class="link" href="glib-Basic-Types.html#gboolean" title="gboolean"><span class="returnvalue">gboolean</span></a>
g_regex_check_replacement (<em class="parameter"><code>const <a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="type">gchar</span></a> *replacement</code></em>,
                           <em class="parameter"><code><a class="link" href="glib-Basic-Types.html#gboolean" title="gboolean"><span class="type">gboolean</span></a> *has_references</code></em>,
                           <em class="parameter"><code><a class="link" href="glib-Error-Reporting.html#GError" title="struct GError"><span class="type">GError</span></a> **error</code></em>);</pre>
<p>Checks whether <em class="parameter"><code>replacement</code></em>
 is a valid replacement string
(see <a class="link" href="glib-Perl-compatible-regular-expressions.html#g-regex-replace" title="g_regex_replace ()"><code class="function">g_regex_replace()</code></a>), i.e. that all escape sequences in
it are valid.</p>
<p>If <em class="parameter"><code>has_references</code></em>
 is not <a class="link" href="glib-Standard-Macros.html#NULL:CAPS" title="NULL"><code class="literal">NULL</code></a> then <em class="parameter"><code>replacement</code></em>
 is checked
for pattern references. For instance, replacement text 'foo\n'
does not contain references and may be evaluated without information
about actual match, but '\0\1' (whole match followed by first
subpattern) requires valid <a class="link" href="glib-Perl-compatible-regular-expressions.html#GMatchInfo" title="GMatchInfo"><span class="type">GMatchInfo</span></a> object.</p>
<div class="refsect3">
<a name="g-regex-check-replacement.parameters"></a><h4>Parameters</h4>
<div class="informaltable"><table class="informaltable" width="100%" border="0">
<colgroup>
<col width="150px" class="parameters_name">
<col class="parameters_description">
<col width="200px" class="parameters_annotations">
</colgroup>
<tbody>
<tr>
<td class="parameter_name"><p>replacement</p></td>
<td class="parameter_description"><p>the replacement string</p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>has_references</p></td>
<td class="parameter_description"><p> location to store information about
references in <em class="parameter"><code>replacement</code></em>
or <a class="link" href="glib-Standard-Macros.html#NULL:CAPS" title="NULL"><code class="literal">NULL</code></a>. </p></td>
<td class="parameter_annotations"><span class="annotation">[<acronym title="Parameter for returning results. Default is transfer full."><span class="acronym">out</span></acronym>][<acronym title="NULL is OK, both for passing and for returning."><span class="acronym">allow-none</span></acronym>]</span></td>
</tr>
<tr>
<td class="parameter_name"><p>error</p></td>
<td class="parameter_description"><p>location to store error</p></td>
<td class="parameter_annotations"> </td>
</tr>
</tbody>
</table></div>
</div>
<div class="refsect3">
<a name="g-regex-check-replacement.returns"></a><h4>Returns</h4>
<p> whether <em class="parameter"><code>replacement</code></em>
is a valid replacement string</p>
</div>
<p class="since">Since: <a class="link" href="api-index-2-14.html#api-index-2.14">2.14</a></p>
</div>
<hr>
<div class="refsect2">
<a name="g-match-info-get-regex"></a><h3>g_match_info_get_regex ()</h3>
<pre class="programlisting"><a class="link" href="glib-Perl-compatible-regular-expressions.html#GRegex" title="GRegex"><span class="returnvalue">GRegex</span></a> *
g_match_info_get_regex (<em class="parameter"><code>const <a class="link" href="glib-Perl-compatible-regular-expressions.html#GMatchInfo" title="GMatchInfo"><span class="type">GMatchInfo</span></a> *match_info</code></em>);</pre>
<p>Returns <a class="link" href="glib-Perl-compatible-regular-expressions.html#GRegex" title="GRegex"><span class="type">GRegex</span></a> object used in <em class="parameter"><code>match_info</code></em>
. It belongs to Glib
and must not be freed. Use <a class="link" href="glib-Perl-compatible-regular-expressions.html#g-regex-ref" title="g_regex_ref ()"><code class="function">g_regex_ref()</code></a> if you need to keep it
after you free <em class="parameter"><code>match_info</code></em>
 object.</p>
<div class="refsect3">
<a name="g-match-info-get-regex.parameters"></a><h4>Parameters</h4>
<div class="informaltable"><table class="informaltable" width="100%" border="0">
<colgroup>
<col width="150px" class="parameters_name">
<col class="parameters_description">
<col width="200px" class="parameters_annotations">
</colgroup>
<tbody><tr>
<td class="parameter_name"><p>match_info</p></td>
<td class="parameter_description"><p>a <a class="link" href="glib-Perl-compatible-regular-expressions.html#GMatchInfo" title="GMatchInfo"><span class="type">GMatchInfo</span></a></p></td>
<td class="parameter_annotations"> </td>
</tr></tbody>
</table></div>
</div>
<div class="refsect3">
<a name="g-match-info-get-regex.returns"></a><h4>Returns</h4>
<p> <a class="link" href="glib-Perl-compatible-regular-expressions.html#GRegex" title="GRegex"><span class="type">GRegex</span></a> object used in <em class="parameter"><code>match_info</code></em>
</p>
</div>
<p class="since">Since: <a class="link" href="api-index-2-14.html#api-index-2.14">2.14</a></p>
</div>
<hr>
<div class="refsect2">
<a name="g-match-info-get-string"></a><h3>g_match_info_get_string ()</h3>
<pre class="programlisting">const <a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="returnvalue">gchar</span></a> *
g_match_info_get_string (<em class="parameter"><code>const <a class="link" href="glib-Perl-compatible-regular-expressions.html#GMatchInfo" title="GMatchInfo"><span class="type">GMatchInfo</span></a> *match_info</code></em>);</pre>
<p>Returns the string searched with <em class="parameter"><code>match_info</code></em>
. This is the
string passed to <a class="link" href="glib-Perl-compatible-regular-expressions.html#g-regex-match" title="g_regex_match ()"><code class="function">g_regex_match()</code></a> or <a class="link" href="glib-Perl-compatible-regular-expressions.html#g-regex-replace" title="g_regex_replace ()"><code class="function">g_regex_replace()</code></a> so
you may not free it before calling this function.</p>
<div class="refsect3">
<a name="g-match-info-get-string.parameters"></a><h4>Parameters</h4>
<div class="informaltable"><table class="informaltable" width="100%" border="0">
<colgroup>
<col width="150px" class="parameters_name">
<col class="parameters_description">
<col width="200px" class="parameters_annotations">
</colgroup>
<tbody><tr>
<td class="parameter_name"><p>match_info</p></td>
<td class="parameter_description"><p>a <a class="link" href="glib-Perl-compatible-regular-expressions.html#GMatchInfo" title="GMatchInfo"><span class="type">GMatchInfo</span></a></p></td>
<td class="parameter_annotations"> </td>
</tr></tbody>
</table></div>
</div>
<div class="refsect3">
<a name="g-match-info-get-string.returns"></a><h4>Returns</h4>
<p> the string searched with <em class="parameter"><code>match_info</code></em>
</p>
</div>
<p class="since">Since: <a class="link" href="api-index-2-14.html#api-index-2.14">2.14</a></p>
</div>
<hr>
<div class="refsect2">
<a name="g-match-info-ref"></a><h3>g_match_info_ref ()</h3>
<pre class="programlisting"><a class="link" href="glib-Perl-compatible-regular-expressions.html#GMatchInfo" title="GMatchInfo"><span class="returnvalue">GMatchInfo</span></a> *
g_match_info_ref (<em class="parameter"><code><a class="link" href="glib-Perl-compatible-regular-expressions.html#GMatchInfo" title="GMatchInfo"><span class="type">GMatchInfo</span></a> *match_info</code></em>);</pre>
<p>Increases reference count of <em class="parameter"><code>match_info</code></em>
 by 1.</p>
<div class="refsect3">
<a name="g-match-info-ref.parameters"></a><h4>Parameters</h4>
<div class="informaltable"><table class="informaltable" width="100%" border="0">
<colgroup>
<col width="150px" class="parameters_name">
<col class="parameters_description">
<col width="200px" class="parameters_annotations">
</colgroup>
<tbody><tr>
<td class="parameter_name"><p>match_info</p></td>
<td class="parameter_description"><p>a <a class="link" href="glib-Perl-compatible-regular-expressions.html#GMatchInfo" title="GMatchInfo"><span class="type">GMatchInfo</span></a></p></td>
<td class="parameter_annotations"> </td>
</tr></tbody>
</table></div>
</div>
<div class="refsect3">
<a name="g-match-info-ref.returns"></a><h4>Returns</h4>
<p> <em class="parameter"><code>match_info</code></em>
</p>
</div>
<p class="since">Since: <a class="link" href="api-index-2-30.html#api-index-2.30">2.30</a></p>
</div>
<hr>
<div class="refsect2">
<a name="g-match-info-unref"></a><h3>g_match_info_unref ()</h3>
<pre class="programlisting"><span class="returnvalue">void</span>
g_match_info_unref (<em class="parameter"><code><a class="link" href="glib-Perl-compatible-regular-expressions.html#GMatchInfo" title="GMatchInfo"><span class="type">GMatchInfo</span></a> *match_info</code></em>);</pre>
<p>Decreases reference count of <em class="parameter"><code>match_info</code></em>
 by 1. When reference count drops
to zero, it frees all the memory associated with the match_info structure.</p>
<div class="refsect3">
<a name="g-match-info-unref.parameters"></a><h4>Parameters</h4>
<div class="informaltable"><table class="informaltable" width="100%" border="0">
<colgroup>
<col width="150px" class="parameters_name">
<col class="parameters_description">
<col width="200px" class="parameters_annotations">
</colgroup>
<tbody><tr>
<td class="parameter_name"><p>match_info</p></td>
<td class="parameter_description"><p>a <a class="link" href="glib-Perl-compatible-regular-expressions.html#GMatchInfo" title="GMatchInfo"><span class="type">GMatchInfo</span></a></p></td>
<td class="parameter_annotations"> </td>
</tr></tbody>
</table></div>
</div>
<p class="since">Since: <a class="link" href="api-index-2-30.html#api-index-2.30">2.30</a></p>
</div>
<hr>
<div class="refsect2">
<a name="g-match-info-free"></a><h3>g_match_info_free ()</h3>
<pre class="programlisting"><span class="returnvalue">void</span>
g_match_info_free (<em class="parameter"><code><a class="link" href="glib-Perl-compatible-regular-expressions.html#GMatchInfo" title="GMatchInfo"><span class="type">GMatchInfo</span></a> *match_info</code></em>);</pre>
<p>If <em class="parameter"><code>match_info</code></em>
 is not <a class="link" href="glib-Standard-Macros.html#NULL:CAPS" title="NULL"><code class="literal">NULL</code></a>, calls <a class="link" href="glib-Perl-compatible-regular-expressions.html#g-match-info-unref" title="g_match_info_unref ()"><code class="function">g_match_info_unref()</code></a>; otherwise does
nothing.</p>
<div class="refsect3">
<a name="g-match-info-free.parameters"></a><h4>Parameters</h4>
<div class="informaltable"><table class="informaltable" width="100%" border="0">
<colgroup>
<col width="150px" class="parameters_name">
<col class="parameters_description">
<col width="200px" class="parameters_annotations">
</colgroup>
<tbody><tr>
<td class="parameter_name"><p>match_info</p></td>
<td class="parameter_description"><p> a <a class="link" href="glib-Perl-compatible-regular-expressions.html#GMatchInfo" title="GMatchInfo"><span class="type">GMatchInfo</span></a>, or <a class="link" href="glib-Standard-Macros.html#NULL:CAPS" title="NULL"><code class="literal">NULL</code></a>. </p></td>
<td class="parameter_annotations"><span class="annotation">[<acronym title="NULL is OK, both for passing and for returning."><span class="acronym">allow-none</span></acronym>]</span></td>
</tr></tbody>
</table></div>
</div>
<p class="since">Since: <a class="link" href="api-index-2-14.html#api-index-2.14">2.14</a></p>
</div>
<hr>
<div class="refsect2">
<a name="g-match-info-matches"></a><h3>g_match_info_matches ()</h3>
<pre class="programlisting"><a class="link" href="glib-Basic-Types.html#gboolean" title="gboolean"><span class="returnvalue">gboolean</span></a>
g_match_info_matches (<em class="parameter"><code>const <a class="link" href="glib-Perl-compatible-regular-expressions.html#GMatchInfo" title="GMatchInfo"><span class="type">GMatchInfo</span></a> *match_info</code></em>);</pre>
<p>Returns whether the previous match operation succeeded.</p>
<div class="refsect3">
<a name="g-match-info-matches.parameters"></a><h4>Parameters</h4>
<div class="informaltable"><table class="informaltable" width="100%" border="0">
<colgroup>
<col width="150px" class="parameters_name">
<col class="parameters_description">
<col width="200px" class="parameters_annotations">
</colgroup>
<tbody><tr>
<td class="parameter_name"><p>match_info</p></td>
<td class="parameter_description"><p>a <a class="link" href="glib-Perl-compatible-regular-expressions.html#GMatchInfo" title="GMatchInfo"><span class="type">GMatchInfo</span></a> structure</p></td>
<td class="parameter_annotations"> </td>
</tr></tbody>
</table></div>
</div>
<div class="refsect3">
<a name="g-match-info-matches.returns"></a><h4>Returns</h4>
<p> <a class="link" href="glib-Standard-Macros.html#TRUE:CAPS" title="TRUE"><code class="literal">TRUE</code></a> if the previous match operation succeeded,
<a class="link" href="glib-Standard-Macros.html#FALSE:CAPS" title="FALSE"><code class="literal">FALSE</code></a> otherwise</p>
</div>
<p class="since">Since: <a class="link" href="api-index-2-14.html#api-index-2.14">2.14</a></p>
</div>
<hr>
<div class="refsect2">
<a name="g-match-info-next"></a><h3>g_match_info_next ()</h3>
<pre class="programlisting"><a class="link" href="glib-Basic-Types.html#gboolean" title="gboolean"><span class="returnvalue">gboolean</span></a>
g_match_info_next (<em class="parameter"><code><a class="link" href="glib-Perl-compatible-regular-expressions.html#GMatchInfo" title="GMatchInfo"><span class="type">GMatchInfo</span></a> *match_info</code></em>,
                   <em class="parameter"><code><a class="link" href="glib-Error-Reporting.html#GError" title="struct GError"><span class="type">GError</span></a> **error</code></em>);</pre>
<p>Scans for the next match using the same parameters of the previous
call to <a class="link" href="glib-Perl-compatible-regular-expressions.html#g-regex-match-full" title="g_regex_match_full ()"><code class="function">g_regex_match_full()</code></a> or <a class="link" href="glib-Perl-compatible-regular-expressions.html#g-regex-match" title="g_regex_match ()"><code class="function">g_regex_match()</code></a> that returned
<em class="parameter"><code>match_info</code></em>
.</p>
<p>The match is done on the string passed to the match function, so you
cannot free it before calling this function.</p>
<div class="refsect3">
<a name="g-match-info-next.parameters"></a><h4>Parameters</h4>
<div class="informaltable"><table class="informaltable" width="100%" border="0">
<colgroup>
<col width="150px" class="parameters_name">
<col class="parameters_description">
<col width="200px" class="parameters_annotations">
</colgroup>
<tbody>
<tr>
<td class="parameter_name"><p>match_info</p></td>
<td class="parameter_description"><p>a <a class="link" href="glib-Perl-compatible-regular-expressions.html#GMatchInfo" title="GMatchInfo"><span class="type">GMatchInfo</span></a> structure</p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>error</p></td>
<td class="parameter_description"><p>location to store the error occurring, or <a class="link" href="glib-Standard-Macros.html#NULL:CAPS" title="NULL"><code class="literal">NULL</code></a> to ignore errors</p></td>
<td class="parameter_annotations"> </td>
</tr>
</tbody>
</table></div>
</div>
<div class="refsect3">
<a name="g-match-info-next.returns"></a><h4>Returns</h4>
<p> <a class="link" href="glib-Standard-Macros.html#TRUE:CAPS" title="TRUE"><code class="literal">TRUE</code></a> is the string matched, <a class="link" href="glib-Standard-Macros.html#FALSE:CAPS" title="FALSE"><code class="literal">FALSE</code></a> otherwise</p>
</div>
<p class="since">Since: <a class="link" href="api-index-2-14.html#api-index-2.14">2.14</a></p>
</div>
<hr>
<div class="refsect2">
<a name="g-match-info-get-match-count"></a><h3>g_match_info_get_match_count ()</h3>
<pre class="programlisting"><a class="link" href="glib-Basic-Types.html#gint" title="gint ()"><span class="returnvalue">gint</span></a>
g_match_info_get_match_count (<em class="parameter"><code>const <a class="link" href="glib-Perl-compatible-regular-expressions.html#GMatchInfo" title="GMatchInfo"><span class="type">GMatchInfo</span></a> *match_info</code></em>);</pre>
<p>Retrieves the number of matched substrings (including substring 0,
that is the whole matched text), so 1 is returned if the pattern
has no substrings in it and 0 is returned if the match failed.</p>
<p>If the last match was obtained using the DFA algorithm, that is
using <a class="link" href="glib-Perl-compatible-regular-expressions.html#g-regex-match-all" title="g_regex_match_all ()"><code class="function">g_regex_match_all()</code></a> or <a class="link" href="glib-Perl-compatible-regular-expressions.html#g-regex-match-all-full" title="g_regex_match_all_full ()"><code class="function">g_regex_match_all_full()</code></a>, the retrieved
count is not that of the number of capturing parentheses but that of
the number of matched substrings.</p>
<div class="refsect3">
<a name="g-match-info-get-match-count.parameters"></a><h4>Parameters</h4>
<div class="informaltable"><table class="informaltable" width="100%" border="0">
<colgroup>
<col width="150px" class="parameters_name">
<col class="parameters_description">
<col width="200px" class="parameters_annotations">
</colgroup>
<tbody><tr>
<td class="parameter_name"><p>match_info</p></td>
<td class="parameter_description"><p>a <a class="link" href="glib-Perl-compatible-regular-expressions.html#GMatchInfo" title="GMatchInfo"><span class="type">GMatchInfo</span></a> structure</p></td>
<td class="parameter_annotations"> </td>
</tr></tbody>
</table></div>
</div>
<div class="refsect3">
<a name="g-match-info-get-match-count.returns"></a><h4>Returns</h4>
<p> Number of matched substrings, or -1 if an error occurred</p>
</div>
<p class="since">Since: <a class="link" href="api-index-2-14.html#api-index-2.14">2.14</a></p>
</div>
<hr>
<div class="refsect2">
<a name="g-match-info-is-partial-match"></a><h3>g_match_info_is_partial_match ()</h3>
<pre class="programlisting"><a class="link" href="glib-Basic-Types.html#gboolean" title="gboolean"><span class="returnvalue">gboolean</span></a>
g_match_info_is_partial_match (<em class="parameter"><code>const <a class="link" href="glib-Perl-compatible-regular-expressions.html#GMatchInfo" title="GMatchInfo"><span class="type">GMatchInfo</span></a> *match_info</code></em>);</pre>
<p>Usually if the string passed to g_regex_match*() matches as far as
it goes, but is too short to match the entire pattern, <a class="link" href="glib-Standard-Macros.html#FALSE:CAPS" title="FALSE"><code class="literal">FALSE</code></a> is
returned. There are circumstances where it might be helpful to
distinguish this case from other cases in which there is no match.</p>
<p>Consider, for example, an application where a human is required to
type in data for a field with specific formatting requirements. An
example might be a date in the form ddmmmyy, defined by the pattern
"^\d?\d(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)\d\d$".
If the application sees the user’s keystrokes one by one, and can
check that what has been typed so far is potentially valid, it is
able to raise an error as soon as a mistake is made.</p>
<p>GRegex supports the concept of partial matching by means of the
<a class="link" href="glib-Perl-compatible-regular-expressions.html#G-REGEX-MATCH-PARTIAL-SOFT:CAPS"><span class="type">G_REGEX_MATCH_PARTIAL_SOFT</span></a> and <a class="link" href="glib-Perl-compatible-regular-expressions.html#G-REGEX-MATCH-PARTIAL-HARD:CAPS"><span class="type">G_REGEX_MATCH_PARTIAL_HARD</span></a> flags.
When they are used, the return code for
<a class="link" href="glib-Perl-compatible-regular-expressions.html#g-regex-match" title="g_regex_match ()"><code class="function">g_regex_match()</code></a> or <a class="link" href="glib-Perl-compatible-regular-expressions.html#g-regex-match-full" title="g_regex_match_full ()"><code class="function">g_regex_match_full()</code></a> is, as usual, <a class="link" href="glib-Standard-Macros.html#TRUE:CAPS" title="TRUE"><code class="literal">TRUE</code></a>
for a complete match, <a class="link" href="glib-Standard-Macros.html#FALSE:CAPS" title="FALSE"><code class="literal">FALSE</code></a> otherwise. But, when these functions
return <a class="link" href="glib-Standard-Macros.html#FALSE:CAPS" title="FALSE"><code class="literal">FALSE</code></a>, you can check if the match was partial calling
<a class="link" href="glib-Perl-compatible-regular-expressions.html#g-match-info-is-partial-match" title="g_match_info_is_partial_match ()"><code class="function">g_match_info_is_partial_match()</code></a>.</p>
<p>The difference between <a class="link" href="glib-Perl-compatible-regular-expressions.html#G-REGEX-MATCH-PARTIAL-SOFT:CAPS"><span class="type">G_REGEX_MATCH_PARTIAL_SOFT</span></a> and 
<a class="link" href="glib-Perl-compatible-regular-expressions.html#G-REGEX-MATCH-PARTIAL-HARD:CAPS"><span class="type">G_REGEX_MATCH_PARTIAL_HARD</span></a> is that when a partial match is encountered
with <a class="link" href="glib-Perl-compatible-regular-expressions.html#G-REGEX-MATCH-PARTIAL-SOFT:CAPS"><span class="type">G_REGEX_MATCH_PARTIAL_SOFT</span></a>, matching continues to search for a
possible complete match, while with <a class="link" href="glib-Perl-compatible-regular-expressions.html#G-REGEX-MATCH-PARTIAL-HARD:CAPS"><span class="type">G_REGEX_MATCH_PARTIAL_HARD</span></a> matching
stops at the partial match.
When both <a class="link" href="glib-Perl-compatible-regular-expressions.html#G-REGEX-MATCH-PARTIAL-SOFT:CAPS"><span class="type">G_REGEX_MATCH_PARTIAL_SOFT</span></a> and <a class="link" href="glib-Perl-compatible-regular-expressions.html#G-REGEX-MATCH-PARTIAL-HARD:CAPS"><span class="type">G_REGEX_MATCH_PARTIAL_HARD</span></a>
are set, the latter takes precedence.</p>
<p>There were formerly some restrictions on the pattern for partial matching.
The restrictions no longer apply.</p>
<p>See pcrepartial(3) for more information on partial matching.</p>
<div class="refsect3">
<a name="g-match-info-is-partial-match.parameters"></a><h4>Parameters</h4>
<div class="informaltable"><table class="informaltable" width="100%" border="0">
<colgroup>
<col width="150px" class="parameters_name">
<col class="parameters_description">
<col width="200px" class="parameters_annotations">
</colgroup>
<tbody><tr>
<td class="parameter_name"><p>match_info</p></td>
<td class="parameter_description"><p>a <a class="link" href="glib-Perl-compatible-regular-expressions.html#GMatchInfo" title="GMatchInfo"><span class="type">GMatchInfo</span></a> structure</p></td>
<td class="parameter_annotations"> </td>
</tr></tbody>
</table></div>
</div>
<div class="refsect3">
<a name="g-match-info-is-partial-match.returns"></a><h4>Returns</h4>
<p> <a class="link" href="glib-Standard-Macros.html#TRUE:CAPS" title="TRUE"><code class="literal">TRUE</code></a> if the match was partial, <a class="link" href="glib-Standard-Macros.html#FALSE:CAPS" title="FALSE"><code class="literal">FALSE</code></a> otherwise</p>
</div>
<p class="since">Since: <a class="link" href="api-index-2-14.html#api-index-2.14">2.14</a></p>
</div>
<hr>
<div class="refsect2">
<a name="g-match-info-expand-references"></a><h3>g_match_info_expand_references ()</h3>
<pre class="programlisting"><a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="returnvalue">gchar</span></a> *
g_match_info_expand_references (<em class="parameter"><code>const <a class="link" href="glib-Perl-compatible-regular-expressions.html#GMatchInfo" title="GMatchInfo"><span class="type">GMatchInfo</span></a> *match_info</code></em>,
                                <em class="parameter"><code>const <a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="type">gchar</span></a> *string_to_expand</code></em>,
                                <em class="parameter"><code><a class="link" href="glib-Error-Reporting.html#GError" title="struct GError"><span class="type">GError</span></a> **error</code></em>);</pre>
<p>Returns a new string containing the text in <em class="parameter"><code>string_to_expand</code></em>
 with
references and escape sequences expanded. References refer to the last
match done with <em class="parameter"><code>string</code></em>
 against <em class="parameter"><code>regex</code></em>
 and have the same syntax used by
<a class="link" href="glib-Perl-compatible-regular-expressions.html#g-regex-replace" title="g_regex_replace ()"><code class="function">g_regex_replace()</code></a>.</p>
<p>The <em class="parameter"><code>string_to_expand</code></em>
 must be UTF-8 encoded even if <a class="link" href="glib-Perl-compatible-regular-expressions.html#G-REGEX-RAW:CAPS"><span class="type">G_REGEX_RAW</span></a> was
passed to <a class="link" href="glib-Perl-compatible-regular-expressions.html#g-regex-new" title="g_regex_new ()"><code class="function">g_regex_new()</code></a>.</p>
<p>The backreferences are extracted from the string passed to the match
function, so you cannot call this function after freeing the string.</p>
<p><em class="parameter"><code>match_info</code></em>
 may be <a class="link" href="glib-Standard-Macros.html#NULL:CAPS" title="NULL"><code class="literal">NULL</code></a> in which case <em class="parameter"><code>string_to_expand</code></em>
 must not
contain references. For instance "foo\n" does not refer to an actual
pattern and '\n' merely will be replaced with \n character,
while to expand "\0" (whole match) one needs the result of a match.
Use <a class="link" href="glib-Perl-compatible-regular-expressions.html#g-regex-check-replacement" title="g_regex_check_replacement ()"><code class="function">g_regex_check_replacement()</code></a> to find out whether <em class="parameter"><code>string_to_expand</code></em>

contains references.</p>
<div class="refsect3">
<a name="g-match-info-expand-references.parameters"></a><h4>Parameters</h4>
<div class="informaltable"><table class="informaltable" width="100%" border="0">
<colgroup>
<col width="150px" class="parameters_name">
<col class="parameters_description">
<col width="200px" class="parameters_annotations">
</colgroup>
<tbody>
<tr>
<td class="parameter_name"><p>match_info</p></td>
<td class="parameter_description"><p> a <a class="link" href="glib-Perl-compatible-regular-expressions.html#GMatchInfo" title="GMatchInfo"><span class="type">GMatchInfo</span></a> or <a class="link" href="glib-Standard-Macros.html#NULL:CAPS" title="NULL"><code class="literal">NULL</code></a>. </p></td>
<td class="parameter_annotations"><span class="annotation">[<acronym title="NULL is OK, both for passing and for returning."><span class="acronym">allow-none</span></acronym>]</span></td>
</tr>
<tr>
<td class="parameter_name"><p>string_to_expand</p></td>
<td class="parameter_description"><p>the string to expand</p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>error</p></td>
<td class="parameter_description"><p>location to store the error occurring, or <a class="link" href="glib-Standard-Macros.html#NULL:CAPS" title="NULL"><code class="literal">NULL</code></a> to ignore errors</p></td>
<td class="parameter_annotations"> </td>
</tr>
</tbody>
</table></div>
</div>
<div class="refsect3">
<a name="g-match-info-expand-references.returns"></a><h4>Returns</h4>
<p> the expanded string, or <a class="link" href="glib-Standard-Macros.html#NULL:CAPS" title="NULL"><code class="literal">NULL</code></a> if an error occurred. </p>
<p><span class="annotation">[<acronym title="NULL is OK, both for passing and for returning."><span class="acronym">allow-none</span></acronym>]</span></p>
</div>
<p class="since">Since: <a class="link" href="api-index-2-14.html#api-index-2.14">2.14</a></p>
</div>
<hr>
<div class="refsect2">
<a name="g-match-info-fetch"></a><h3>g_match_info_fetch ()</h3>
<pre class="programlisting"><a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="returnvalue">gchar</span></a> *
g_match_info_fetch (<em class="parameter"><code>const <a class="link" href="glib-Perl-compatible-regular-expressions.html#GMatchInfo" title="GMatchInfo"><span class="type">GMatchInfo</span></a> *match_info</code></em>,
                    <em class="parameter"><code><a class="link" href="glib-Basic-Types.html#gint" title="gint ()"><span class="type">gint</span></a> match_num</code></em>);</pre>
<p>Retrieves the text matching the <em class="parameter"><code>match_num</code></em>
'th capturing
parentheses. 0 is the full text of the match, 1 is the first paren
set, 2 the second, and so on.</p>
<p>If <em class="parameter"><code>match_num</code></em>
 is a valid sub pattern but it didn't match anything
(e.g. sub pattern 1, matching "b" against "(a)?b") then an empty
string is returned.</p>
<p>If the match was obtained using the DFA algorithm, that is using
<a class="link" href="glib-Perl-compatible-regular-expressions.html#g-regex-match-all" title="g_regex_match_all ()"><code class="function">g_regex_match_all()</code></a> or <a class="link" href="glib-Perl-compatible-regular-expressions.html#g-regex-match-all-full" title="g_regex_match_all_full ()"><code class="function">g_regex_match_all_full()</code></a>, the retrieved
string is not that of a set of parentheses but that of a matched
substring. Substrings are matched in reverse order of length, so
0 is the longest match.</p>
<p>The string is fetched from the string passed to the match function,
so you cannot call this function after freeing the string.</p>
<div class="refsect3">
<a name="g-match-info-fetch.parameters"></a><h4>Parameters</h4>
<div class="informaltable"><table class="informaltable" width="100%" border="0">
<colgroup>
<col width="150px" class="parameters_name">
<col class="parameters_description">
<col width="200px" class="parameters_annotations">
</colgroup>
<tbody>
<tr>
<td class="parameter_name"><p>match_info</p></td>
<td class="parameter_description"><p><a class="link" href="glib-Perl-compatible-regular-expressions.html#GMatchInfo" title="GMatchInfo"><span class="type">GMatchInfo</span></a> structure</p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>match_num</p></td>
<td class="parameter_description"><p>number of the sub expression</p></td>
<td class="parameter_annotations"> </td>
</tr>
</tbody>
</table></div>
</div>
<div class="refsect3">
<a name="g-match-info-fetch.returns"></a><h4>Returns</h4>
<p> The matched substring, or <a class="link" href="glib-Standard-Macros.html#NULL:CAPS" title="NULL"><code class="literal">NULL</code></a> if an error
occurred. You have to free the string yourself. </p>
<p><span class="annotation">[<acronym title="NULL is OK, both for passing and for returning."><span class="acronym">allow-none</span></acronym>]</span></p>
</div>
<p class="since">Since: <a class="link" href="api-index-2-14.html#api-index-2.14">2.14</a></p>
</div>
<hr>
<div class="refsect2">
<a name="g-match-info-fetch-pos"></a><h3>g_match_info_fetch_pos ()</h3>
<pre class="programlisting"><a class="link" href="glib-Basic-Types.html#gboolean" title="gboolean"><span class="returnvalue">gboolean</span></a>
g_match_info_fetch_pos (<em class="parameter"><code>const <a class="link" href="glib-Perl-compatible-regular-expressions.html#GMatchInfo" title="GMatchInfo"><span class="type">GMatchInfo</span></a> *match_info</code></em>,
                        <em class="parameter"><code><a class="link" href="glib-Basic-Types.html#gint" title="gint ()"><span class="type">gint</span></a> match_num</code></em>,
                        <em class="parameter"><code><a class="link" href="glib-Basic-Types.html#gint" title="gint ()"><span class="type">gint</span></a> *start_pos</code></em>,
                        <em class="parameter"><code><a class="link" href="glib-Basic-Types.html#gint" title="gint ()"><span class="type">gint</span></a> *end_pos</code></em>);</pre>
<p>Retrieves the position in bytes of the <em class="parameter"><code>match_num</code></em>
'th capturing
parentheses. 0 is the full text of the match, 1 is the first
paren set, 2 the second, and so on.</p>
<p>If <em class="parameter"><code>match_num</code></em>
 is a valid sub pattern but it didn't match anything
(e.g. sub pattern 1, matching "b" against "(a)?b") then <em class="parameter"><code>start_pos</code></em>

and <em class="parameter"><code>end_pos</code></em>
 are set to -1 and <a class="link" href="glib-Standard-Macros.html#TRUE:CAPS" title="TRUE"><code class="literal">TRUE</code></a> is returned.</p>
<p>If the match was obtained using the DFA algorithm, that is using
<a class="link" href="glib-Perl-compatible-regular-expressions.html#g-regex-match-all" title="g_regex_match_all ()"><code class="function">g_regex_match_all()</code></a> or <a class="link" href="glib-Perl-compatible-regular-expressions.html#g-regex-match-all-full" title="g_regex_match_all_full ()"><code class="function">g_regex_match_all_full()</code></a>, the retrieved
position is not that of a set of parentheses but that of a matched
substring. Substrings are matched in reverse order of length, so
0 is the longest match.</p>
<div class="refsect3">
<a name="g-match-info-fetch-pos.parameters"></a><h4>Parameters</h4>
<div class="informaltable"><table class="informaltable" width="100%" border="0">
<colgroup>
<col width="150px" class="parameters_name">
<col class="parameters_description">
<col width="200px" class="parameters_annotations">
</colgroup>
<tbody>
<tr>
<td class="parameter_name"><p>match_info</p></td>
<td class="parameter_description"><p><a class="link" href="glib-Perl-compatible-regular-expressions.html#GMatchInfo" title="GMatchInfo"><span class="type">GMatchInfo</span></a> structure</p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>match_num</p></td>
<td class="parameter_description"><p>number of the sub expression</p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>start_pos</p></td>
<td class="parameter_description"><p> pointer to location where to store
the start position, or <a class="link" href="glib-Standard-Macros.html#NULL:CAPS" title="NULL"><code class="literal">NULL</code></a>. </p></td>
<td class="parameter_annotations"><span class="annotation">[<acronym title="Parameter for returning results. Default is transfer full."><span class="acronym">out</span></acronym>][<acronym title="NULL is OK, both for passing and for returning."><span class="acronym">allow-none</span></acronym>]</span></td>
</tr>
<tr>
<td class="parameter_name"><p>end_pos</p></td>
<td class="parameter_description"><p> pointer to location where to store
the end position, or <a class="link" href="glib-Standard-Macros.html#NULL:CAPS" title="NULL"><code class="literal">NULL</code></a>. </p></td>
<td class="parameter_annotations"><span class="annotation">[<acronym title="Parameter for returning results. Default is transfer full."><span class="acronym">out</span></acronym>][<acronym title="NULL is OK, both for passing and for returning."><span class="acronym">allow-none</span></acronym>]</span></td>
</tr>
</tbody>
</table></div>
</div>
<div class="refsect3">
<a name="g-match-info-fetch-pos.returns"></a><h4>Returns</h4>
<p> <a class="link" href="glib-Standard-Macros.html#TRUE:CAPS" title="TRUE"><code class="literal">TRUE</code></a> if the position was fetched, <a class="link" href="glib-Standard-Macros.html#FALSE:CAPS" title="FALSE"><code class="literal">FALSE</code></a> otherwise. If
the position cannot be fetched, <em class="parameter"><code>start_pos</code></em>
and <em class="parameter"><code>end_pos</code></em>
are left
unchanged</p>
</div>
<p class="since">Since: <a class="link" href="api-index-2-14.html#api-index-2.14">2.14</a></p>
</div>
<hr>
<div class="refsect2">
<a name="g-match-info-fetch-named"></a><h3>g_match_info_fetch_named ()</h3>
<pre class="programlisting"><a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="returnvalue">gchar</span></a> *
g_match_info_fetch_named (<em class="parameter"><code>const <a class="link" href="glib-Perl-compatible-regular-expressions.html#GMatchInfo" title="GMatchInfo"><span class="type">GMatchInfo</span></a> *match_info</code></em>,
                          <em class="parameter"><code>const <a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="type">gchar</span></a> *name</code></em>);</pre>
<p>Retrieves the text matching the capturing parentheses named <em class="parameter"><code>name</code></em>
.</p>
<p>If <em class="parameter"><code>name</code></em>
 is a valid sub pattern name but it didn't match anything
(e.g. sub pattern "X", matching "b" against "(?P&lt;X&gt;a)?b")
then an empty string is returned.</p>
<p>The string is fetched from the string passed to the match function,
so you cannot call this function after freeing the string.</p>
<div class="refsect3">
<a name="g-match-info-fetch-named.parameters"></a><h4>Parameters</h4>
<div class="informaltable"><table class="informaltable" width="100%" border="0">
<colgroup>
<col width="150px" class="parameters_name">
<col class="parameters_description">
<col width="200px" class="parameters_annotations">
</colgroup>
<tbody>
<tr>
<td class="parameter_name"><p>match_info</p></td>
<td class="parameter_description"><p><a class="link" href="glib-Perl-compatible-regular-expressions.html#GMatchInfo" title="GMatchInfo"><span class="type">GMatchInfo</span></a> structure</p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>name</p></td>
<td class="parameter_description"><p>name of the subexpression</p></td>
<td class="parameter_annotations"> </td>
</tr>
</tbody>
</table></div>
</div>
<div class="refsect3">
<a name="g-match-info-fetch-named.returns"></a><h4>Returns</h4>
<p> The matched substring, or <a class="link" href="glib-Standard-Macros.html#NULL:CAPS" title="NULL"><code class="literal">NULL</code></a> if an error
occurred. You have to free the string yourself. </p>
<p><span class="annotation">[<acronym title="NULL is OK, both for passing and for returning."><span class="acronym">allow-none</span></acronym>]</span></p>
</div>
<p class="since">Since: <a class="link" href="api-index-2-14.html#api-index-2.14">2.14</a></p>
</div>
<hr>
<div class="refsect2">
<a name="g-match-info-fetch-named-pos"></a><h3>g_match_info_fetch_named_pos ()</h3>
<pre class="programlisting"><a class="link" href="glib-Basic-Types.html#gboolean" title="gboolean"><span class="returnvalue">gboolean</span></a>
g_match_info_fetch_named_pos (<em class="parameter"><code>const <a class="link" href="glib-Perl-compatible-regular-expressions.html#GMatchInfo" title="GMatchInfo"><span class="type">GMatchInfo</span></a> *match_info</code></em>,
                              <em class="parameter"><code>const <a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="type">gchar</span></a> *name</code></em>,
                              <em class="parameter"><code><a class="link" href="glib-Basic-Types.html#gint" title="gint ()"><span class="type">gint</span></a> *start_pos</code></em>,
                              <em class="parameter"><code><a class="link" href="glib-Basic-Types.html#gint" title="gint ()"><span class="type">gint</span></a> *end_pos</code></em>);</pre>
<p>Retrieves the position in bytes of the capturing parentheses named <em class="parameter"><code>name</code></em>
.</p>
<p>If <em class="parameter"><code>name</code></em>
 is a valid sub pattern name but it didn't match anything
(e.g. sub pattern "X", matching "b" against "(?P&lt;X&gt;a)?b")
then <em class="parameter"><code>start_pos</code></em>
 and <em class="parameter"><code>end_pos</code></em>
 are set to -1 and <a class="link" href="glib-Standard-Macros.html#TRUE:CAPS" title="TRUE"><code class="literal">TRUE</code></a> is returned.</p>
<div class="refsect3">
<a name="g-match-info-fetch-named-pos.parameters"></a><h4>Parameters</h4>
<div class="informaltable"><table class="informaltable" width="100%" border="0">
<colgroup>
<col width="150px" class="parameters_name">
<col class="parameters_description">
<col width="200px" class="parameters_annotations">
</colgroup>
<tbody>
<tr>
<td class="parameter_name"><p>match_info</p></td>
<td class="parameter_description"><p><a class="link" href="glib-Perl-compatible-regular-expressions.html#GMatchInfo" title="GMatchInfo"><span class="type">GMatchInfo</span></a> structure</p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>name</p></td>
<td class="parameter_description"><p>name of the subexpression</p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>start_pos</p></td>
<td class="parameter_description"><p> pointer to location where to store
the start position, or <a class="link" href="glib-Standard-Macros.html#NULL:CAPS" title="NULL"><code class="literal">NULL</code></a>. </p></td>
<td class="parameter_annotations"><span class="annotation">[<acronym title="Parameter for returning results. Default is transfer full."><span class="acronym">out</span></acronym>][<acronym title="NULL is OK, both for passing and for returning."><span class="acronym">allow-none</span></acronym>]</span></td>
</tr>
<tr>
<td class="parameter_name"><p>end_pos</p></td>
<td class="parameter_description"><p> pointer to location where to store
the end position, or <a class="link" href="glib-Standard-Macros.html#NULL:CAPS" title="NULL"><code class="literal">NULL</code></a>. </p></td>
<td class="parameter_annotations"><span class="annotation">[<acronym title="Parameter for returning results. Default is transfer full."><span class="acronym">out</span></acronym>][<acronym title="NULL is OK, both for passing and for returning."><span class="acronym">allow-none</span></acronym>]</span></td>
</tr>
</tbody>
</table></div>
</div>
<div class="refsect3">
<a name="g-match-info-fetch-named-pos.returns"></a><h4>Returns</h4>
<p> <a class="link" href="glib-Standard-Macros.html#TRUE:CAPS" title="TRUE"><code class="literal">TRUE</code></a> if the position was fetched, <a class="link" href="glib-Standard-Macros.html#FALSE:CAPS" title="FALSE"><code class="literal">FALSE</code></a> otherwise.
If the position cannot be fetched, <em class="parameter"><code>start_pos</code></em>
and <em class="parameter"><code>end_pos</code></em>
are left unchanged.</p>
</div>
<p class="since">Since: <a class="link" href="api-index-2-14.html#api-index-2.14">2.14</a></p>
</div>
<hr>
<div class="refsect2">
<a name="g-match-info-fetch-all"></a><h3>g_match_info_fetch_all ()</h3>
<pre class="programlisting"><a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="returnvalue">gchar</span></a> **
g_match_info_fetch_all (<em class="parameter"><code>const <a class="link" href="glib-Perl-compatible-regular-expressions.html#GMatchInfo" title="GMatchInfo"><span class="type">GMatchInfo</span></a> *match_info</code></em>);</pre>
<p>Bundles up pointers to each of the matching substrings from a match
and stores them in an array of gchar pointers. The first element in
the returned array is the match number 0, i.e. the entire matched
text.</p>
<p>If a sub pattern didn't match anything (e.g. sub pattern 1, matching
"b" against "(a)?b") then an empty string is inserted.</p>
<p>If the last match was obtained using the DFA algorithm, that is using
<a class="link" href="glib-Perl-compatible-regular-expressions.html#g-regex-match-all" title="g_regex_match_all ()"><code class="function">g_regex_match_all()</code></a> or <a class="link" href="glib-Perl-compatible-regular-expressions.html#g-regex-match-all-full" title="g_regex_match_all_full ()"><code class="function">g_regex_match_all_full()</code></a>, the retrieved
strings are not that matched by sets of parentheses but that of the
matched substring. Substrings are matched in reverse order of length,
so the first one is the longest match.</p>
<p>The strings are fetched from the string passed to the match function,
so you cannot call this function after freeing the string.</p>
<div class="refsect3">
<a name="g-match-info-fetch-all.parameters"></a><h4>Parameters</h4>
<div class="informaltable"><table class="informaltable" width="100%" border="0">
<colgroup>
<col width="150px" class="parameters_name">
<col class="parameters_description">
<col width="200px" class="parameters_annotations">
</colgroup>
<tbody><tr>
<td class="parameter_name"><p>match_info</p></td>
<td class="parameter_description"><p>a <a class="link" href="glib-Perl-compatible-regular-expressions.html#GMatchInfo" title="GMatchInfo"><span class="type">GMatchInfo</span></a> structure</p></td>
<td class="parameter_annotations"> </td>
</tr></tbody>
</table></div>
</div>
<div class="refsect3">
<a name="g-match-info-fetch-all.returns"></a><h4>Returns</h4>
<p> a <a class="link" href="glib-Standard-Macros.html#NULL:CAPS" title="NULL"><code class="literal">NULL</code></a>-terminated array of gchar *
pointers.  It must be freed using <a class="link" href="glib-String-Utility-Functions.html#g-strfreev" title="g_strfreev ()"><code class="function">g_strfreev()</code></a>. If the previous
match failed <a class="link" href="glib-Standard-Macros.html#NULL:CAPS" title="NULL"><code class="literal">NULL</code></a> is returned. </p>
<p><span class="annotation">[<acronym title="Free data after the code is done."><span class="acronym">transfer full</span></acronym>]</span></p>
</div>
<p class="since">Since: <a class="link" href="api-index-2-14.html#api-index-2.14">2.14</a></p>
</div>
</div>
<div class="refsect1">
<a name="glib-Perl-compatible-regular-expressions.other_details"></a><h2>Types and Values</h2>
<div class="refsect2">
<a name="GRegexError"></a><h3>enum GRegexError</h3>
<p>Error codes returned by regular expressions functions.</p>
<div class="refsect3">
<a name="GRegexError.members"></a><h4>Members</h4>
<div class="informaltable"><table class="informaltable" width="100%" border="0">
<colgroup>
<col width="300px" class="enum_members_name">
<col class="enum_members_description">
<col width="200px" class="enum_members_annotations">
</colgroup>
<tbody>
<tr>
<td class="enum_member_name"><p><a name="G-REGEX-ERROR-COMPILE:CAPS"></a>G_REGEX_ERROR_COMPILE</p></td>
<td class="enum_member_description">
<p>Compilation of the regular expression failed.</p>
</td>
<td class="enum_member_annotations"> </td>
</tr>
<tr>
<td class="enum_member_name"><p><a name="G-REGEX-ERROR-OPTIMIZE:CAPS"></a>G_REGEX_ERROR_OPTIMIZE</p></td>
<td class="enum_member_description">
<p>Optimization of the regular expression failed.</p>
</td>
<td class="enum_member_annotations"> </td>
</tr>
<tr>
<td class="enum_member_name"><p><a name="G-REGEX-ERROR-REPLACE:CAPS"></a>G_REGEX_ERROR_REPLACE</p></td>
<td class="enum_member_description">
<p>Replacement failed due to an ill-formed replacement
    string.</p>
</td>
<td class="enum_member_annotations"> </td>
</tr>
<tr>
<td class="enum_member_name"><p><a name="G-REGEX-ERROR-MATCH:CAPS"></a>G_REGEX_ERROR_MATCH</p></td>
<td class="enum_member_description">
<p>The match process failed.</p>
</td>
<td class="enum_member_annotations"> </td>
</tr>
<tr>
<td class="enum_member_name"><p><a name="G-REGEX-ERROR-INTERNAL:CAPS"></a>G_REGEX_ERROR_INTERNAL</p></td>
<td class="enum_member_description">
<p>Internal error of the regular expression engine.
    Since 2.16</p>
</td>
<td class="enum_member_annotations"> </td>
</tr>
<tr>
<td class="enum_member_name"><p><a name="G-REGEX-ERROR-STRAY-BACKSLASH:CAPS"></a>G_REGEX_ERROR_STRAY_BACKSLASH</p></td>
<td class="enum_member_description">
<p>"\" at end of pattern. Since 2.16</p>
</td>
<td class="enum_member_annotations"> </td>
</tr>
<tr>
<td class="enum_member_name"><p><a name="G-REGEX-ERROR-MISSING-CONTROL-CHAR:CAPS"></a>G_REGEX_ERROR_MISSING_CONTROL_CHAR</p></td>
<td class="enum_member_description">
<p>"\c" at end of pattern. Since 2.16</p>
</td>
<td class="enum_member_annotations"> </td>
</tr>
<tr>
<td class="enum_member_name"><p><a name="G-REGEX-ERROR-UNRECOGNIZED-ESCAPE:CAPS"></a>G_REGEX_ERROR_UNRECOGNIZED_ESCAPE</p></td>
<td class="enum_member_description">
<p>Unrecognized character follows "\".
    Since 2.16</p>
</td>
<td class="enum_member_annotations"> </td>
</tr>
<tr>
<td class="enum_member_name"><p><a name="G-REGEX-ERROR-QUANTIFIERS-OUT-OF-ORDER:CAPS"></a>G_REGEX_ERROR_QUANTIFIERS_OUT_OF_ORDER</p></td>
<td class="enum_member_description">
<p>Numbers out of order in "{}"
    quantifier. Since 2.16</p>
</td>
<td class="enum_member_annotations"> </td>
</tr>
<tr>
<td class="enum_member_name"><p><a name="G-REGEX-ERROR-QUANTIFIER-TOO-BIG:CAPS"></a>G_REGEX_ERROR_QUANTIFIER_TOO_BIG</p></td>
<td class="enum_member_description">
<p>Number too big in "{}" quantifier.
    Since 2.16</p>
</td>
<td class="enum_member_annotations"> </td>
</tr>
<tr>
<td class="enum_member_name"><p><a name="G-REGEX-ERROR-UNTERMINATED-CHARACTER-CLASS:CAPS"></a>G_REGEX_ERROR_UNTERMINATED_CHARACTER_CLASS</p></td>
<td class="enum_member_description">
<p>Missing terminating "]" for
    character class. Since 2.16</p>
</td>
<td class="enum_member_annotations"> </td>
</tr>
<tr>
<td class="enum_member_name"><p><a name="G-REGEX-ERROR-INVALID-ESCAPE-IN-CHARACTER-CLASS:CAPS"></a>G_REGEX_ERROR_INVALID_ESCAPE_IN_CHARACTER_CLASS</p></td>
<td class="enum_member_description">
<p>Invalid escape sequence
    in character class. Since 2.16</p>
</td>
<td class="enum_member_annotations"> </td>
</tr>
<tr>
<td class="enum_member_name"><p><a name="G-REGEX-ERROR-RANGE-OUT-OF-ORDER:CAPS"></a>G_REGEX_ERROR_RANGE_OUT_OF_ORDER</p></td>
<td class="enum_member_description">
<p>Range out of order in character class.
    Since 2.16</p>
</td>
<td class="enum_member_annotations"> </td>
</tr>
<tr>
<td class="enum_member_name"><p><a name="G-REGEX-ERROR-NOTHING-TO-REPEAT:CAPS"></a>G_REGEX_ERROR_NOTHING_TO_REPEAT</p></td>
<td class="enum_member_description">
<p>Nothing to repeat. Since 2.16</p>
</td>
<td class="enum_member_annotations"> </td>
</tr>
<tr>
<td class="enum_member_name"><p><a name="G-REGEX-ERROR-UNRECOGNIZED-CHARACTER:CAPS"></a>G_REGEX_ERROR_UNRECOGNIZED_CHARACTER</p></td>
<td class="enum_member_description">
<p>Unrecognized character after "(?",
    "(?&lt;" or "(?P". Since 2.16</p>
</td>
<td class="enum_member_annotations"> </td>
</tr>
<tr>
<td class="enum_member_name"><p><a name="G-REGEX-ERROR-POSIX-NAMED-CLASS-OUTSIDE-CLASS:CAPS"></a>G_REGEX_ERROR_POSIX_NAMED_CLASS_OUTSIDE_CLASS</p></td>
<td class="enum_member_description">
<p>POSIX named classes are
    supported only within a class. Since 2.16</p>
</td>
<td class="enum_member_annotations"> </td>
</tr>
<tr>
<td class="enum_member_name"><p><a name="G-REGEX-ERROR-UNMATCHED-PARENTHESIS:CAPS"></a>G_REGEX_ERROR_UNMATCHED_PARENTHESIS</p></td>
<td class="enum_member_description">
<p>Missing terminating ")" or ")"
    without opening "(". Since 2.16</p>
</td>
<td class="enum_member_annotations"> </td>
</tr>
<tr>
<td class="enum_member_name"><p><a name="G-REGEX-ERROR-INEXISTENT-SUBPATTERN-REFERENCE:CAPS"></a>G_REGEX_ERROR_INEXISTENT_SUBPATTERN_REFERENCE</p></td>
<td class="enum_member_description">
<p>Reference to non-existent
    subpattern. Since 2.16</p>
</td>
<td class="enum_member_annotations"> </td>
</tr>
<tr>
<td class="enum_member_name"><p><a name="G-REGEX-ERROR-UNTERMINATED-COMMENT:CAPS"></a>G_REGEX_ERROR_UNTERMINATED_COMMENT</p></td>
<td class="enum_member_description">
<p>Missing terminating ")" after comment.
    Since 2.16</p>
</td>
<td class="enum_member_annotations"> </td>
</tr>
<tr>
<td class="enum_member_name"><p><a name="G-REGEX-ERROR-EXPRESSION-TOO-LARGE:CAPS"></a>G_REGEX_ERROR_EXPRESSION_TOO_LARGE</p></td>
<td class="enum_member_description">
<p>Regular expression too large.
    Since 2.16</p>
</td>
<td class="enum_member_annotations"> </td>
</tr>
<tr>
<td class="enum_member_name"><p><a name="G-REGEX-ERROR-MEMORY-ERROR:CAPS"></a>G_REGEX_ERROR_MEMORY_ERROR</p></td>
<td class="enum_member_description">
<p>Failed to get memory. Since 2.16</p>
</td>
<td class="enum_member_annotations"> </td>
</tr>
<tr>
<td class="enum_member_name"><p><a name="G-REGEX-ERROR-VARIABLE-LENGTH-LOOKBEHIND:CAPS"></a>G_REGEX_ERROR_VARIABLE_LENGTH_LOOKBEHIND</p></td>
<td class="enum_member_description">
<p>Lookbehind assertion is not
    fixed length. Since 2.16</p>
</td>
<td class="enum_member_annotations"> </td>
</tr>
<tr>
<td class="enum_member_name"><p><a name="G-REGEX-ERROR-MALFORMED-CONDITION:CAPS"></a>G_REGEX_ERROR_MALFORMED_CONDITION</p></td>
<td class="enum_member_description">
<p>Malformed number or name after "(?(".
    Since 2.16</p>
</td>
<td class="enum_member_annotations"> </td>
</tr>
<tr>
<td class="enum_member_name"><p><a name="G-REGEX-ERROR-TOO-MANY-CONDITIONAL-BRANCHES:CAPS"></a>G_REGEX_ERROR_TOO_MANY_CONDITIONAL_BRANCHES</p></td>
<td class="enum_member_description">
<p>Conditional group contains
    more than two branches. Since 2.16</p>
</td>
<td class="enum_member_annotations"> </td>
</tr>
<tr>
<td class="enum_member_name"><p><a name="G-REGEX-ERROR-ASSERTION-EXPECTED:CAPS"></a>G_REGEX_ERROR_ASSERTION_EXPECTED</p></td>
<td class="enum_member_description">
<p>Assertion expected after "(?(".
    Since 2.16</p>
</td>
<td class="enum_member_annotations"> </td>
</tr>
<tr>
<td class="enum_member_name"><p><a name="G-REGEX-ERROR-UNKNOWN-POSIX-CLASS-NAME:CAPS"></a>G_REGEX_ERROR_UNKNOWN_POSIX_CLASS_NAME</p></td>
<td class="enum_member_description">
<p>Unknown POSIX class name.
    Since 2.16</p>
</td>
<td class="enum_member_annotations"> </td>
</tr>
<tr>
<td class="enum_member_name"><p><a name="G-REGEX-ERROR-POSIX-COLLATING-ELEMENTS-NOT-SUPPORTED:CAPS"></a>G_REGEX_ERROR_POSIX_COLLATING_ELEMENTS_NOT_SUPPORTED</p></td>
<td class="enum_member_description">
<p>POSIX collating
    elements are not supported. Since 2.16</p>
</td>
<td class="enum_member_annotations"> </td>
</tr>
<tr>
<td class="enum_member_name"><p><a name="G-REGEX-ERROR-HEX-CODE-TOO-LARGE:CAPS"></a>G_REGEX_ERROR_HEX_CODE_TOO_LARGE</p></td>
<td class="enum_member_description">
<p>Character value in "\x{...}" sequence
    is too large. Since 2.16</p>
</td>
<td class="enum_member_annotations"> </td>
</tr>
<tr>
<td class="enum_member_name"><p><a name="G-REGEX-ERROR-INVALID-CONDITION:CAPS"></a>G_REGEX_ERROR_INVALID_CONDITION</p></td>
<td class="enum_member_description">
<p>Invalid condition "(?(0)". Since 2.16</p>
</td>
<td class="enum_member_annotations"> </td>
</tr>
<tr>
<td class="enum_member_name"><p><a name="G-REGEX-ERROR-SINGLE-BYTE-MATCH-IN-LOOKBEHIND:CAPS"></a>G_REGEX_ERROR_SINGLE_BYTE_MATCH_IN_LOOKBEHIND</p></td>
<td class="enum_member_description">
<p>\C not allowed in
    lookbehind assertion. Since 2.16</p>
</td>
<td class="enum_member_annotations"> </td>
</tr>
<tr>
<td class="enum_member_name"><p><a name="G-REGEX-ERROR-INFINITE-LOOP:CAPS"></a>G_REGEX_ERROR_INFINITE_LOOP</p></td>
<td class="enum_member_description">
<p>Recursive call could loop indefinitely.
    Since 2.16</p>
</td>
<td class="enum_member_annotations"> </td>
</tr>
<tr>
<td class="enum_member_name"><p><a name="G-REGEX-ERROR-MISSING-SUBPATTERN-NAME-TERMINATOR:CAPS"></a>G_REGEX_ERROR_MISSING_SUBPATTERN_NAME_TERMINATOR</p></td>
<td class="enum_member_description">
<p>Missing terminator
    in subpattern name. Since 2.16</p>
</td>
<td class="enum_member_annotations"> </td>
</tr>
<tr>
<td class="enum_member_name"><p><a name="G-REGEX-ERROR-DUPLICATE-SUBPATTERN-NAME:CAPS"></a>G_REGEX_ERROR_DUPLICATE_SUBPATTERN_NAME</p></td>
<td class="enum_member_description">
<p>Two named subpatterns have
    the same name. Since 2.16</p>
</td>
<td class="enum_member_annotations"> </td>
</tr>
<tr>
<td class="enum_member_name"><p><a name="G-REGEX-ERROR-MALFORMED-PROPERTY:CAPS"></a>G_REGEX_ERROR_MALFORMED_PROPERTY</p></td>
<td class="enum_member_description">
<p>Malformed "\P" or "\p" sequence.
    Since 2.16</p>
</td>
<td class="enum_member_annotations"> </td>
</tr>
<tr>
<td class="enum_member_name"><p><a name="G-REGEX-ERROR-UNKNOWN-PROPERTY:CAPS"></a>G_REGEX_ERROR_UNKNOWN_PROPERTY</p></td>
<td class="enum_member_description">
<p>Unknown property name after "\P" or
    "\p". Since 2.16</p>
</td>
<td class="enum_member_annotations"> </td>
</tr>
<tr>
<td class="enum_member_name"><p><a name="G-REGEX-ERROR-SUBPATTERN-NAME-TOO-LONG:CAPS"></a>G_REGEX_ERROR_SUBPATTERN_NAME_TOO_LONG</p></td>
<td class="enum_member_description">
<p>Subpattern name is too long
    (maximum 32 characters). Since 2.16</p>
</td>
<td class="enum_member_annotations"> </td>
</tr>
<tr>
<td class="enum_member_name"><p><a name="G-REGEX-ERROR-TOO-MANY-SUBPATTERNS:CAPS"></a>G_REGEX_ERROR_TOO_MANY_SUBPATTERNS</p></td>
<td class="enum_member_description">
<p>Too many named subpatterns (maximum
    10,000). Since 2.16</p>
</td>
<td class="enum_member_annotations"> </td>
</tr>
<tr>
<td class="enum_member_name"><p><a name="G-REGEX-ERROR-INVALID-OCTAL-VALUE:CAPS"></a>G_REGEX_ERROR_INVALID_OCTAL_VALUE</p></td>
<td class="enum_member_description">
<p>Octal value is greater than "\377".
    Since 2.16</p>
</td>
<td class="enum_member_annotations"> </td>
</tr>
<tr>
<td class="enum_member_name"><p><a name="G-REGEX-ERROR-TOO-MANY-BRANCHES-IN-DEFINE:CAPS"></a>G_REGEX_ERROR_TOO_MANY_BRANCHES_IN_DEFINE</p></td>
<td class="enum_member_description">
<p>"DEFINE" group contains more
    than one branch. Since 2.16</p>
</td>
<td class="enum_member_annotations"> </td>
</tr>
<tr>
<td class="enum_member_name"><p><a name="G-REGEX-ERROR-DEFINE-REPETION:CAPS"></a>G_REGEX_ERROR_DEFINE_REPETION</p></td>
<td class="enum_member_description">
<p>Repeating a "DEFINE" group is not allowed.
    This error is never raised. Since: 2.16 Deprecated: 2.34</p>
</td>
<td class="enum_member_annotations"> </td>
</tr>
<tr>
<td class="enum_member_name"><p><a name="G-REGEX-ERROR-INCONSISTENT-NEWLINE-OPTIONS:CAPS"></a>G_REGEX_ERROR_INCONSISTENT_NEWLINE_OPTIONS</p></td>
<td class="enum_member_description">
<p>Inconsistent newline options.
    Since 2.16</p>
</td>
<td class="enum_member_annotations"> </td>
</tr>
<tr>
<td class="enum_member_name"><p><a name="G-REGEX-ERROR-MISSING-BACK-REFERENCE:CAPS"></a>G_REGEX_ERROR_MISSING_BACK_REFERENCE</p></td>
<td class="enum_member_description">
<p>"\g" is not followed by a braced,
     angle-bracketed, or quoted name or number, or by a plain number. Since: 2.16</p>
</td>
<td class="enum_member_annotations"> </td>
</tr>
<tr>
<td class="enum_member_name"><p><a name="G-REGEX-ERROR-INVALID-RELATIVE-REFERENCE:CAPS"></a>G_REGEX_ERROR_INVALID_RELATIVE_REFERENCE</p></td>
<td class="enum_member_description">
<p>relative reference must not be zero. Since: 2.34</p>
</td>
<td class="enum_member_annotations"> </td>
</tr>
<tr>
<td class="enum_member_name"><p><a name="G-REGEX-ERROR-BACKTRACKING-CONTROL-VERB-ARGUMENT-FORBIDDEN:CAPS"></a>G_REGEX_ERROR_BACKTRACKING_CONTROL_VERB_ARGUMENT_FORBIDDEN</p></td>
<td class="enum_member_description">
<p>the backtracing
    control verb used does not allow an argument. Since: 2.34</p>
</td>
<td class="enum_member_annotations"> </td>
</tr>
<tr>
<td class="enum_member_name"><p><a name="G-REGEX-ERROR-UNKNOWN-BACKTRACKING-CONTROL-VERB:CAPS"></a>G_REGEX_ERROR_UNKNOWN_BACKTRACKING_CONTROL_VERB</p></td>
<td class="enum_member_description">
<p>unknown backtracing 
    control verb. Since: 2.34</p>
</td>
<td class="enum_member_annotations"> </td>
</tr>
<tr>
<td class="enum_member_name"><p><a name="G-REGEX-ERROR-NUMBER-TOO-BIG:CAPS"></a>G_REGEX_ERROR_NUMBER_TOO_BIG</p></td>
<td class="enum_member_description">
<p>number is too big in escape sequence. Since: 2.34</p>
</td>
<td class="enum_member_annotations"> </td>
</tr>
<tr>
<td class="enum_member_name"><p><a name="G-REGEX-ERROR-MISSING-SUBPATTERN-NAME:CAPS"></a>G_REGEX_ERROR_MISSING_SUBPATTERN_NAME</p></td>
<td class="enum_member_description">
<p>Missing subpattern name. Since: 2.34</p>
</td>
<td class="enum_member_annotations"> </td>
</tr>
<tr>
<td class="enum_member_name"><p><a name="G-REGEX-ERROR-MISSING-DIGIT:CAPS"></a>G_REGEX_ERROR_MISSING_DIGIT</p></td>
<td class="enum_member_description">
<p>Missing digit. Since 2.34</p>
</td>
<td class="enum_member_annotations"> </td>
</tr>
<tr>
<td class="enum_member_name"><p><a name="G-REGEX-ERROR-INVALID-DATA-CHARACTER:CAPS"></a>G_REGEX_ERROR_INVALID_DATA_CHARACTER</p></td>
<td class="enum_member_description">
<p>In JavaScript compatibility mode,
    "[" is an invalid data character. Since: 2.34</p>
</td>
<td class="enum_member_annotations"> </td>
</tr>
<tr>
<td class="enum_member_name"><p><a name="G-REGEX-ERROR-EXTRA-SUBPATTERN-NAME:CAPS"></a>G_REGEX_ERROR_EXTRA_SUBPATTERN_NAME</p></td>
<td class="enum_member_description">
<p>different names for subpatterns of the 
    same number are not allowed. Since: 2.34</p>
</td>
<td class="enum_member_annotations"> </td>
</tr>
<tr>
<td class="enum_member_name"><p><a name="G-REGEX-ERROR-BACKTRACKING-CONTROL-VERB-ARGUMENT-REQUIRED:CAPS"></a>G_REGEX_ERROR_BACKTRACKING_CONTROL_VERB_ARGUMENT_REQUIRED</p></td>
<td class="enum_member_description">
<p>the backtracing control
    verb requires an argument. Since: 2.34</p>
</td>
<td class="enum_member_annotations"> </td>
</tr>
<tr>
<td class="enum_member_name"><p><a name="G-REGEX-ERROR-INVALID-CONTROL-CHAR:CAPS"></a>G_REGEX_ERROR_INVALID_CONTROL_CHAR</p></td>
<td class="enum_member_description">
<p>"\c" must be followed by an ASCII 
    character. Since: 2.34</p>
</td>
<td class="enum_member_annotations"> </td>
</tr>
<tr>
<td class="enum_member_name"><p><a name="G-REGEX-ERROR-MISSING-NAME:CAPS"></a>G_REGEX_ERROR_MISSING_NAME</p></td>
<td class="enum_member_description">
<p>"\k" is not followed by a braced, angle-bracketed, or 
    quoted name. Since: 2.34</p>
</td>
<td class="enum_member_annotations"> </td>
</tr>
<tr>
<td class="enum_member_name"><p><a name="G-REGEX-ERROR-NOT-SUPPORTED-IN-CLASS:CAPS"></a>G_REGEX_ERROR_NOT_SUPPORTED_IN_CLASS</p></td>
<td class="enum_member_description">
<p>"\N" is not supported in a class. Since: 2.34</p>
</td>
<td class="enum_member_annotations"> </td>
</tr>
<tr>
<td class="enum_member_name"><p><a name="G-REGEX-ERROR-TOO-MANY-FORWARD-REFERENCES:CAPS"></a>G_REGEX_ERROR_TOO_MANY_FORWARD_REFERENCES</p></td>
<td class="enum_member_description">
<p>too many forward references. Since: 2.34</p>
</td>
<td class="enum_member_annotations"> </td>
</tr>
<tr>
<td class="enum_member_name"><p><a name="G-REGEX-ERROR-NAME-TOO-LONG:CAPS"></a>G_REGEX_ERROR_NAME_TOO_LONG</p></td>
<td class="enum_member_description">
<p>the name is too long in "(*MARK)", "(*PRUNE)", 
    "(*SKIP)", or "(*THEN)". Since: 2.34</p>
</td>
<td class="enum_member_annotations"> </td>
</tr>
<tr>
<td class="enum_member_name"><p><a name="G-REGEX-ERROR-CHARACTER-VALUE-TOO-LARGE:CAPS"></a>G_REGEX_ERROR_CHARACTER_VALUE_TOO_LARGE</p></td>
<td class="enum_member_description">
<p>the character value in the \u sequence is
    too large. Since: 2.34</p>
</td>
<td class="enum_member_annotations"> </td>
</tr>
</tbody>
</table></div>
</div>
<p class="since">Since: <a class="link" href="api-index-2-14.html#api-index-2.14">2.14</a></p>
</div>
<hr>
<div class="refsect2">
<a name="G-REGEX-ERROR:CAPS"></a><h3>G_REGEX_ERROR</h3>
<pre class="programlisting">#define G_REGEX_ERROR g_regex_error_quark ()
</pre>
<p>Error domain for regular expressions. Errors in this domain will be
from the <a class="link" href="glib-Perl-compatible-regular-expressions.html#GRegexError" title="enum GRegexError"><span class="type">GRegexError</span></a> enumeration. See <a class="link" href="glib-Error-Reporting.html#GError" title="struct GError"><span class="type">GError</span></a> for information on
error domains.</p>
<p class="since">Since: <a class="link" href="api-index-2-14.html#api-index-2.14">2.14</a></p>
</div>
<hr>
<div class="refsect2">
<a name="GRegexCompileFlags"></a><h3>enum GRegexCompileFlags</h3>
<p>Flags specifying compile-time options.</p>
<div class="refsect3">
<a name="GRegexCompileFlags.members"></a><h4>Members</h4>
<div class="informaltable"><table class="informaltable" width="100%" border="0">
<colgroup>
<col width="300px" class="enum_members_name">
<col class="enum_members_description">
<col width="200px" class="enum_members_annotations">
</colgroup>
<tbody>
<tr>
<td class="enum_member_name"><p><a name="G-REGEX-CASELESS:CAPS"></a>G_REGEX_CASELESS</p></td>
<td class="enum_member_description">
<p>Letters in the pattern match both upper- and
    lowercase letters. This option can be changed within a pattern
    by a "(?i)" option setting.</p>
</td>
<td class="enum_member_annotations"> </td>
</tr>
<tr>
<td class="enum_member_name"><p><a name="G-REGEX-MULTILINE:CAPS"></a>G_REGEX_MULTILINE</p></td>
<td class="enum_member_description">
<p>By default, GRegex treats the strings as consisting
    of a single line of characters (even if it actually contains
    newlines). The "start of line" metacharacter ("^") matches only
    at the start of the string, while the "end of line" metacharacter
    ("$") matches only at the end of the string, or before a terminating
    newline (unless <a class="link" href="glib-Perl-compatible-regular-expressions.html#G-REGEX-DOLLAR-ENDONLY:CAPS"><span class="type">G_REGEX_DOLLAR_ENDONLY</span></a> is set). When
    <a class="link" href="glib-Perl-compatible-regular-expressions.html#G-REGEX-MULTILINE:CAPS"><span class="type">G_REGEX_MULTILINE</span></a> is set, the "start of line" and "end of line"
    constructs match immediately following or immediately before any
    newline in the string, respectively, as well as at the very start
    and end. This can be changed within a pattern by a "(?m)" option
    setting.</p>
</td>
<td class="enum_member_annotations"> </td>
</tr>
<tr>
<td class="enum_member_name"><p><a name="G-REGEX-DOTALL:CAPS"></a>G_REGEX_DOTALL</p></td>
<td class="enum_member_description">
<p>A dot metacharater (".") in the pattern matches all
    characters, including newlines. Without it, newlines are excluded.
    This option can be changed within a pattern by a ("?s") option setting.</p>
</td>
<td class="enum_member_annotations"> </td>
</tr>
<tr>
<td class="enum_member_name"><p><a name="G-REGEX-EXTENDED:CAPS"></a>G_REGEX_EXTENDED</p></td>
<td class="enum_member_description">
<p>Whitespace data characters in the pattern are
    totally ignored except when escaped or inside a character class.
    Whitespace does not include the VT character (code 11). In addition,
    characters between an unescaped "#" outside a character class and
    the next newline character, inclusive, are also ignored. This can
    be changed within a pattern by a "(?x)" option setting.</p>
</td>
<td class="enum_member_annotations"> </td>
</tr>
<tr>
<td class="enum_member_name"><p><a name="G-REGEX-ANCHORED:CAPS"></a>G_REGEX_ANCHORED</p></td>
<td class="enum_member_description">
<p>The pattern is forced to be "anchored", that is,
    it is constrained to match only at the first matching point in the
    string that is being searched. This effect can also be achieved by
    appropriate constructs in the pattern itself such as the "^"
    metacharater.</p>
</td>
<td class="enum_member_annotations"> </td>
</tr>
<tr>
<td class="enum_member_name"><p><a name="G-REGEX-DOLLAR-ENDONLY:CAPS"></a>G_REGEX_DOLLAR_ENDONLY</p></td>
<td class="enum_member_description">
<p>A dollar metacharacter ("$") in the pattern
    matches only at the end of the string. Without this option, a
    dollar also matches immediately before the final character if
    it is a newline (but not before any other newlines). This option
    is ignored if <a class="link" href="glib-Perl-compatible-regular-expressions.html#G-REGEX-MULTILINE:CAPS"><span class="type">G_REGEX_MULTILINE</span></a> is set.</p>
</td>
<td class="enum_member_annotations"> </td>
</tr>
<tr>
<td class="enum_member_name"><p><a name="G-REGEX-UNGREEDY:CAPS"></a>G_REGEX_UNGREEDY</p></td>
<td class="enum_member_description">
<p>Inverts the "greediness" of the quantifiers so that
    they are not greedy by default, but become greedy if followed by "?".
    It can also be set by a "(?U)" option setting within the pattern.</p>
</td>
<td class="enum_member_annotations"> </td>
</tr>
<tr>
<td class="enum_member_name"><p><a name="G-REGEX-RAW:CAPS"></a>G_REGEX_RAW</p></td>
<td class="enum_member_description">
<p>Usually strings must be valid UTF-8 strings, using this
    flag they are considered as a raw sequence of bytes.</p>
</td>
<td class="enum_member_annotations"> </td>
</tr>
<tr>
<td class="enum_member_name"><p><a name="G-REGEX-NO-AUTO-CAPTURE:CAPS"></a>G_REGEX_NO_AUTO_CAPTURE</p></td>
<td class="enum_member_description">
<p>Disables the use of numbered capturing
    parentheses in the pattern. Any opening parenthesis that is not
    followed by "?" behaves as if it were followed by "?:" but named
    parentheses can still be used for capturing (and they acquire numbers
    in the usual way).</p>
</td>
<td class="enum_member_annotations"> </td>
</tr>
<tr>
<td class="enum_member_name"><p><a name="G-REGEX-OPTIMIZE:CAPS"></a>G_REGEX_OPTIMIZE</p></td>
<td class="enum_member_description">
<p>Optimize the regular expression. If the pattern will
    be used many times, then it may be worth the effort to optimize it
    to improve the speed of matches.</p>
</td>
<td class="enum_member_annotations"> </td>
</tr>
<tr>
<td class="enum_member_name"><p><a name="G-REGEX-FIRSTLINE:CAPS"></a>G_REGEX_FIRSTLINE</p></td>
<td class="enum_member_description">
<p>Limits an unanchored pattern to match before (or at) the
    first newline. Since: 2.34</p>
</td>
<td class="enum_member_annotations"> </td>
</tr>
<tr>
<td class="enum_member_name"><p><a name="G-REGEX-DUPNAMES:CAPS"></a>G_REGEX_DUPNAMES</p></td>
<td class="enum_member_description">
<p>Names used to identify capturing subpatterns need not
    be unique. This can be helpful for certain types of pattern when it
    is known that only one instance of the named subpattern can ever be
    matched.</p>
</td>
<td class="enum_member_annotations"> </td>
</tr>
<tr>
<td class="enum_member_name"><p><a name="G-REGEX-NEWLINE-CR:CAPS"></a>G_REGEX_NEWLINE_CR</p></td>
<td class="enum_member_description">
<p>Usually any newline character or character sequence is
    recognized. If this option is set, the only recognized newline character
    is '\r'.</p>
</td>
<td class="enum_member_annotations"> </td>
</tr>
<tr>
<td class="enum_member_name"><p><a name="G-REGEX-NEWLINE-LF:CAPS"></a>G_REGEX_NEWLINE_LF</p></td>
<td class="enum_member_description">
<p>Usually any newline character or character sequence is
    recognized. If this option is set, the only recognized newline character
    is '\n'.</p>
</td>
<td class="enum_member_annotations"> </td>
</tr>
<tr>
<td class="enum_member_name"><p><a name="G-REGEX-NEWLINE-CRLF:CAPS"></a>G_REGEX_NEWLINE_CRLF</p></td>
<td class="enum_member_description">
<p>Usually any newline character or character sequence is
    recognized. If this option is set, the only recognized newline character
    sequence is '\r\n'.</p>
</td>
<td class="enum_member_annotations"> </td>
</tr>
<tr>
<td class="enum_member_name"><p><a name="G-REGEX-NEWLINE-ANYCRLF:CAPS"></a>G_REGEX_NEWLINE_ANYCRLF</p></td>
<td class="enum_member_description">
<p>Usually any newline character or character sequence
    is recognized. If this option is set, the only recognized newline character
    sequences are '\r', '\n', and '\r\n'. Since: 2.34</p>
</td>
<td class="enum_member_annotations"> </td>
</tr>
<tr>
<td class="enum_member_name"><p><a name="G-REGEX-BSR-ANYCRLF:CAPS"></a>G_REGEX_BSR_ANYCRLF</p></td>
<td class="enum_member_description">
<p>Usually any newline character or character sequence
    is recognised. If this option is set, then "\R" only recognizes the newline
   characters '\r', '\n' and '\r\n'. Since: 2.34</p>
</td>
<td class="enum_member_annotations"> </td>
</tr>
<tr>
<td class="enum_member_name"><p><a name="G-REGEX-JAVASCRIPT-COMPAT:CAPS"></a>G_REGEX_JAVASCRIPT_COMPAT</p></td>
<td class="enum_member_description">
<p>Changes behaviour so that it is compatible with
    JavaScript rather than PCRE. Since: 2.34</p>
</td>
<td class="enum_member_annotations"> </td>
</tr>
</tbody>
</table></div>
</div>
<p class="since">Since: <a class="link" href="api-index-2-14.html#api-index-2.14">2.14</a></p>
</div>
<hr>
<div class="refsect2">
<a name="GRegexMatchFlags"></a><h3>enum GRegexMatchFlags</h3>
<p>Flags specifying match-time options.</p>
<div class="refsect3">
<a name="GRegexMatchFlags.members"></a><h4>Members</h4>
<div class="informaltable"><table class="informaltable" width="100%" border="0">
<colgroup>
<col width="300px" class="enum_members_name">
<col class="enum_members_description">
<col width="200px" class="enum_members_annotations">
</colgroup>
<tbody>
<tr>
<td class="enum_member_name"><p><a name="G-REGEX-MATCH-ANCHORED:CAPS"></a>G_REGEX_MATCH_ANCHORED</p></td>
<td class="enum_member_description">
<p>The pattern is forced to be "anchored", that is,
    it is constrained to match only at the first matching point in the
    string that is being searched. This effect can also be achieved by
    appropriate constructs in the pattern itself such as the "^"
    metacharater.</p>
</td>
<td class="enum_member_annotations"> </td>
</tr>
<tr>
<td class="enum_member_name"><p><a name="G-REGEX-MATCH-NOTBOL:CAPS"></a>G_REGEX_MATCH_NOTBOL</p></td>
<td class="enum_member_description">
<p>Specifies that first character of the string is
    not the beginning of a line, so the circumflex metacharacter should
    not match before it. Setting this without <a class="link" href="glib-Perl-compatible-regular-expressions.html#G-REGEX-MULTILINE:CAPS"><span class="type">G_REGEX_MULTILINE</span></a> (at
    compile time) causes circumflex never to match. This option affects
    only the behaviour of the circumflex metacharacter, it does not
    affect "\A".</p>
</td>
<td class="enum_member_annotations"> </td>
</tr>
<tr>
<td class="enum_member_name"><p><a name="G-REGEX-MATCH-NOTEOL:CAPS"></a>G_REGEX_MATCH_NOTEOL</p></td>
<td class="enum_member_description">
<p>Specifies that the end of the subject string is
    not the end of a line, so the dollar metacharacter should not match
    it nor (except in multiline mode) a newline immediately before it.
    Setting this without <a class="link" href="glib-Perl-compatible-regular-expressions.html#G-REGEX-MULTILINE:CAPS"><span class="type">G_REGEX_MULTILINE</span></a> (at compile time) causes
    dollar never to match. This option affects only the behaviour of
    the dollar metacharacter, it does not affect "\Z" or "\z".</p>
</td>
<td class="enum_member_annotations"> </td>
</tr>
<tr>
<td class="enum_member_name"><p><a name="G-REGEX-MATCH-NOTEMPTY:CAPS"></a>G_REGEX_MATCH_NOTEMPTY</p></td>
<td class="enum_member_description">
<p>An empty string is not considered to be a valid
    match if this option is set. If there are alternatives in the pattern,
    they are tried. If all the alternatives match the empty string, the
    entire match fails. For example, if the pattern "a?b?" is applied to
    a string not beginning with "a" or "b", it matches the empty string
    at the start of the string. With this flag set, this match is not
    valid, so GRegex searches further into the string for occurrences
    of "a" or "b".</p>
</td>
<td class="enum_member_annotations"> </td>
</tr>
<tr>
<td class="enum_member_name"><p><a name="G-REGEX-MATCH-PARTIAL:CAPS"></a>G_REGEX_MATCH_PARTIAL</p></td>
<td class="enum_member_description">
<p>Turns on the partial matching feature, for more
    documentation on partial matching see <a class="link" href="glib-Perl-compatible-regular-expressions.html#g-match-info-is-partial-match" title="g_match_info_is_partial_match ()"><code class="function">g_match_info_is_partial_match()</code></a>.</p>
</td>
<td class="enum_member_annotations"> </td>
</tr>
<tr>
<td class="enum_member_name"><p><a name="G-REGEX-MATCH-NEWLINE-CR:CAPS"></a>G_REGEX_MATCH_NEWLINE_CR</p></td>
<td class="enum_member_description">
<p>Overrides the newline definition set when
    creating a new <a class="link" href="glib-Perl-compatible-regular-expressions.html#GRegex" title="GRegex"><span class="type">GRegex</span></a>, setting the '\r' character as line terminator.</p>
</td>
<td class="enum_member_annotations"> </td>
</tr>
<tr>
<td class="enum_member_name"><p><a name="G-REGEX-MATCH-NEWLINE-LF:CAPS"></a>G_REGEX_MATCH_NEWLINE_LF</p></td>
<td class="enum_member_description">
<p>Overrides the newline definition set when
    creating a new <a class="link" href="glib-Perl-compatible-regular-expressions.html#GRegex" title="GRegex"><span class="type">GRegex</span></a>, setting the '\n' character as line terminator.</p>
</td>
<td class="enum_member_annotations"> </td>
</tr>
<tr>
<td class="enum_member_name"><p><a name="G-REGEX-MATCH-NEWLINE-CRLF:CAPS"></a>G_REGEX_MATCH_NEWLINE_CRLF</p></td>
<td class="enum_member_description">
<p>Overrides the newline definition set when
    creating a new <a class="link" href="glib-Perl-compatible-regular-expressions.html#GRegex" title="GRegex"><span class="type">GRegex</span></a>, setting the '\r\n' characters sequence as line terminator.</p>
</td>
<td class="enum_member_annotations"> </td>
</tr>
<tr>
<td class="enum_member_name"><p><a name="G-REGEX-MATCH-NEWLINE-ANY:CAPS"></a>G_REGEX_MATCH_NEWLINE_ANY</p></td>
<td class="enum_member_description">
<p>Overrides the newline definition set when
    creating a new <a class="link" href="glib-Perl-compatible-regular-expressions.html#GRegex" title="GRegex"><span class="type">GRegex</span></a>, any Unicode newline sequence
    is recognised as a newline. These are '\r', '\n' and '\rn', and the
    single characters U+000B LINE TABULATION, U+000C FORM FEED (FF),
    U+0085 NEXT LINE (NEL), U+2028 LINE SEPARATOR and
    U+2029 PARAGRAPH SEPARATOR.</p>
</td>
<td class="enum_member_annotations"> </td>
</tr>
<tr>
<td class="enum_member_name"><p><a name="G-REGEX-MATCH-NEWLINE-ANYCRLF:CAPS"></a>G_REGEX_MATCH_NEWLINE_ANYCRLF</p></td>
<td class="enum_member_description">
<p>Overrides the newline definition set when
    creating a new <a class="link" href="glib-Perl-compatible-regular-expressions.html#GRegex" title="GRegex"><span class="type">GRegex</span></a>; any '\r', '\n', or '\r\n' character sequence
    is recognized as a newline. Since: 2.34</p>
</td>
<td class="enum_member_annotations"> </td>
</tr>
<tr>
<td class="enum_member_name"><p><a name="G-REGEX-MATCH-BSR-ANYCRLF:CAPS"></a>G_REGEX_MATCH_BSR_ANYCRLF</p></td>
<td class="enum_member_description">
<p>Overrides the newline definition for "\R" set when
    creating a new <a class="link" href="glib-Perl-compatible-regular-expressions.html#GRegex" title="GRegex"><span class="type">GRegex</span></a>; only '\r', '\n', or '\r\n' character sequences
    are recognized as a newline by "\R". Since: 2.34</p>
</td>
<td class="enum_member_annotations"> </td>
</tr>
<tr>
<td class="enum_member_name"><p><a name="G-REGEX-MATCH-BSR-ANY:CAPS"></a>G_REGEX_MATCH_BSR_ANY</p></td>
<td class="enum_member_description">
<p>Overrides the newline definition for "\R" set when
    creating a new <a class="link" href="glib-Perl-compatible-regular-expressions.html#GRegex" title="GRegex"><span class="type">GRegex</span></a>; any Unicode newline character or character sequence
    are recognized as a newline by "\R". These are '\r', '\n' and '\rn', and the
    single characters U+000B LINE TABULATION, U+000C FORM FEED (FF),
    U+0085 NEXT LINE (NEL), U+2028 LINE SEPARATOR and
    U+2029 PARAGRAPH SEPARATOR. Since: 2.34</p>
</td>
<td class="enum_member_annotations"> </td>
</tr>
<tr>
<td class="enum_member_name"><p><a name="G-REGEX-MATCH-PARTIAL-SOFT:CAPS"></a>G_REGEX_MATCH_PARTIAL_SOFT</p></td>
<td class="enum_member_description">
<p>An alias for <a class="link" href="glib-Perl-compatible-regular-expressions.html#G-REGEX-MATCH-PARTIAL:CAPS"><span class="type">G_REGEX_MATCH_PARTIAL</span></a>. Since: 2.34</p>
</td>
<td class="enum_member_annotations"> </td>
</tr>
<tr>
<td class="enum_member_name"><p><a name="G-REGEX-MATCH-PARTIAL-HARD:CAPS"></a>G_REGEX_MATCH_PARTIAL_HARD</p></td>
<td class="enum_member_description">
<p>Turns on the partial matching feature. In contrast to
    to <a class="link" href="glib-Perl-compatible-regular-expressions.html#G-REGEX-MATCH-PARTIAL-SOFT:CAPS"><span class="type">G_REGEX_MATCH_PARTIAL_SOFT</span></a>, this stops matching as soon as a partial match
    is found, without continuing to search for a possible complete match. See
    <a class="link" href="glib-Perl-compatible-regular-expressions.html#g-match-info-is-partial-match" title="g_match_info_is_partial_match ()"><code class="function">g_match_info_is_partial_match()</code></a> for more information. Since: 2.34</p>
</td>
<td class="enum_member_annotations"> </td>
</tr>
<tr>
<td class="enum_member_name"><p><a name="G-REGEX-MATCH-NOTEMPTY-ATSTART:CAPS"></a>G_REGEX_MATCH_NOTEMPTY_ATSTART</p></td>
<td class="enum_member_description">
<p>Like <a class="link" href="glib-Perl-compatible-regular-expressions.html#G-REGEX-MATCH-NOTEMPTY:CAPS"><span class="type">G_REGEX_MATCH_NOTEMPTY</span></a>, but only applied to
    the start of the matched string. For anchored
    patterns this can only happen for pattern containing "\K". Since: 2.34</p>
</td>
<td class="enum_member_annotations"> </td>
</tr>
</tbody>
</table></div>
</div>
<p class="since">Since: <a class="link" href="api-index-2-14.html#api-index-2.14">2.14</a></p>
</div>
<hr>
<div class="refsect2">
<a name="GRegex"></a><h3>GRegex</h3>
<pre class="programlisting">typedef struct _GRegex GRegex;</pre>
<p>A GRegex is the "compiled" form of a regular expression pattern.
This structure is opaque and its fields cannot be accessed directly.</p>
<p class="since">Since: <a class="link" href="api-index-2-14.html#api-index-2.14">2.14</a></p>
</div>
<hr>
<div class="refsect2">
<a name="GMatchInfo"></a><h3>GMatchInfo</h3>
<pre class="programlisting">typedef struct _GMatchInfo GMatchInfo;</pre>
<p>A GMatchInfo is an opaque struct used to return information about
matches.</p>
</div>
</div>
<div class="refsect1">
<a name="glib-Perl-compatible-regular-expressions.see-also"></a><h2>See Also</h2>
<p><a class="link" href="glib-regex-syntax.html" title="Regular expression syntax">Regular expression syntax</a></p>
</div>
</div>
<div class="footer">
<hr>Generated by GTK-Doc V1.25.1</div>
</body>
</html>